Update XPLM for ARM64
This commit is contained in:
1 parent
40067a606d
commit
174c20bd8f
59 files changed
+12475
-9196
No files matched your search
@@ -1,276 +1,254 @@
|
||||
{
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
|
||||
All rights reserved. See license.txt for usage.
|
||||
|
||||
X-Plane SDK Version: 2.1.1
|
||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
}
|
||||
|
||||
UNIT XPLMProcessing;
|
||||
INTERFACE
|
||||
{
|
||||
This API allows you to get regular callbacks during the flight loop, the
|
||||
part of X-Plane where the plane's position calculates the physics of
|
||||
flight, etc. Use these APIs to accomplish periodic tasks like logging data
|
||||
and performing I/O.
|
||||
This API allows you to get regular callbacks during the flight loop, the
|
||||
part of X-Plane where the plane's position calculates the physics of
|
||||
flight, etc. Use these APIs to accomplish periodic tasks like logging data
|
||||
and performing I/O.
|
||||
|
||||
WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||
loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||
for graphics.
|
||||
You can receive a callback either just before or just after the per-frame
|
||||
physics calculations happen - you can use post-FM callbacks to "patch" the
|
||||
flight model after it has run.
|
||||
|
||||
If the user has set the number of flight model iterations per frame greater
|
||||
than one your plugin will _not_ see this; these integrations run on the
|
||||
sub-section of the flight model where iterations improve responsiveness
|
||||
(e.g. physical integration, not simple systems tracking) and are thus
|
||||
opaque to plugins.
|
||||
|
||||
Flight loop scheduling, when scheduled by time, is scheduled by a "first
|
||||
callback after the deadline" schedule, e.g. your callbacks will always be
|
||||
slightly late to ensure that we don't run faster than your deadline.
|
||||
|
||||
WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||
loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||
for graphics. (One exception: you can use a post-flight loop callback to
|
||||
update your own off-screen FBOs.)
|
||||
}
|
||||
|
||||
USES XPLMDefs;
|
||||
USES
|
||||
XPLMDefs;
|
||||
{$A4}
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE DELPHI}
|
||||
{$ENDIF}
|
||||
{___________________________________________________________________________
|
||||
* FLIGHT LOOP CALLBACKS
|
||||
___________________________________________________________________________}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMFlightLoopPhaseType
|
||||
|
||||
You can register a flight loop callback to run either before or after the
|
||||
flight model is integrated by X-Plane.
|
||||
You can register a flight loop callback to run either before or after the
|
||||
flight model is integrated by X-Plane.
|
||||
}
|
||||
TYPE
|
||||
XPLMFlightLoopPhaseType = (
|
||||
{ Your callback runs before X-Plane integrates the flight model. }
|
||||
{ Your callback runs before X-Plane integrates the flight model. }
|
||||
xplm_FlightLoop_Phase_BeforeFlightModel = 0
|
||||
|
||||
{ Your callback runs after X-Plane integrates the flight model. }
|
||||
{ Your callback runs after X-Plane integrates the flight model. }
|
||||
,xplm_FlightLoop_Phase_AfterFlightModel = 1
|
||||
|
||||
);
|
||||
PXPLMFlightLoopPhaseType = ^XPLMFlightLoopPhaseType;
|
||||
{$ENDIF}
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMFlightLoopID
|
||||
|
||||
This is an opaque identifier for a flight loop callback. You can use this
|
||||
identifier to easily track and remove your callbacks, or to use the new
|
||||
flight loop APIs.
|
||||
This is an opaque identifier for a flight loop callback. You can use this
|
||||
identifier to easily track and remove your callbacks, or to use the new
|
||||
flight loop APIs.
|
||||
}
|
||||
XPLMFlightLoopID = pointer;
|
||||
PXPLMFlightLoopID = ^XPLMFlightLoopID;
|
||||
{$ENDIF}
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
{
|
||||
XPLMFlightLoop_f
|
||||
|
||||
This is your flight loop callback. Each time the flight loop is iterated
|
||||
through, you receive this call at the end. You receive a time since you
|
||||
were last called and a time since the last loop, as well as a loop counter.
|
||||
The 'phase' parameter is deprecated and should be ignored.
|
||||
This is your flight loop callback. Each time the flight loop is iterated
|
||||
through, you receive this call at the end.
|
||||
|
||||
Your return value controls when you will next be called. Return 0 to stop
|
||||
receiving callbacks. Pass a positive number to specify how many seconds
|
||||
until the next callback. (You will be called at or after this time, not
|
||||
before.) Pass a negative number to specify how many loops must go by until
|
||||
you are called. For example, -1.0 means call me the very next loop. Try
|
||||
to run your flight loop as infrequently as is practical, and suspend it
|
||||
(using return value 0) when you do not need it; lots of flight loop
|
||||
callbacks that do nothing lowers x-plane's frame rate.
|
||||
Flight loop callbacks receive a number of input timing parameters. These
|
||||
input timing parameters are not particularly useful; you may need to track
|
||||
your own timing data (e.g. by reading datarefs). The input parameters are:
|
||||
|
||||
Your callback will NOT be unregistered if you return 0; it will merely be
|
||||
inactive.
|
||||
- inElapsedSinceLastCall: the wall time since your last callback.
|
||||
- inElapsedTimeSinceLastFlightLoop: the wall time since any flight loop was
|
||||
dispatched.
|
||||
- inCounter: a monotonically increasing counter, bumped once per flight
|
||||
loop dispatch from the sim.
|
||||
- inRefcon: your own ptr constant from when you regitered yor callback.
|
||||
|
||||
The reference constant you passed to your loop is passed back to you.
|
||||
Your return value controls when you will next be called.
|
||||
|
||||
- Return 0 to stop receiving callbacks.
|
||||
- Pass a positive number to specify how many seconds until the next
|
||||
callback. (You will be called at or after this time, not before.)
|
||||
- Pass a negative number to specify how many loops must go by until you
|
||||
are called. For example, -1.0 means call me the very next loop.
|
||||
|
||||
Try to run your flight loop as infrequently as is practical, and suspend it
|
||||
(using return value 0) when you do not need it; lots of flight loop
|
||||
callbacks that do nothing lowers X-Plane's frame rate.
|
||||
|
||||
Your callback will NOT be unregistered if you return 0; it will merely be
|
||||
inactive.
|
||||
}
|
||||
TYPE
|
||||
XPLMFlightLoop_f = FUNCTION(
|
||||
inElapsedSinceLastCall: single;
|
||||
inElapsedTimeSinceLastFlightLoop: single;
|
||||
inCounter : integer;
|
||||
inRefcon : pointer) : single; cdecl;
|
||||
inElapsedSinceLastCall: Single;
|
||||
inElapsedTimeSinceLastFlightLoop: Single;
|
||||
inCounter : Integer;
|
||||
inRefcon : pointer) : Single; cdecl;
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMCreateFlightLoop_t
|
||||
|
||||
XPLMCreateFlightLoop_t contains the parameters to create a new flight loop
|
||||
callback. The strsucture can be expanded in future SDKs - always set
|
||||
structSize to the size of your structure in bytes.
|
||||
XPLMCreateFlightLoop_t contains the parameters to create a new flight loop
|
||||
callback. The strsucture can be expanded in future SDKs - always set
|
||||
structSize to the size of your structure in bytes.
|
||||
}
|
||||
TYPE
|
||||
XPLMCreateFlightLoop_t = RECORD
|
||||
structSize : integer;
|
||||
structSize : Integer;
|
||||
phase : XPLMFlightLoopPhaseType;
|
||||
callbackFunc : XPLMFlightLoop_f;
|
||||
refcon : pointer;
|
||||
END;
|
||||
PXPLMCreateFlightLoop_t = ^XPLMCreateFlightLoop_t;
|
||||
{$ENDIF}
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
{
|
||||
XPLMGetElapsedTime
|
||||
|
||||
This routine returns the elapsed time since the sim started up in decimal
|
||||
seconds.
|
||||
This routine returns the elapsed time since the sim started up in decimal
|
||||
seconds. This is a wall timer; it keeps counting upward even if the sim is
|
||||
pasued.
|
||||
|
||||
__WARNING__: XPLMGetElapsedTime is not a very good timer! It lacks
|
||||
precision in both its data type and its source. Do not attempt to use it
|
||||
for timing critical applications like network multiplayer.
|
||||
}
|
||||
FUNCTION XPLMGetElapsedTime: single;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
FUNCTION XPLMGetElapsedTime: Single;
|
||||
cdecl; external XPLM_DLL;
|
||||
|
||||
{
|
||||
XPLMGetCycleNumber
|
||||
|
||||
This routine returns a counter starting at zero for each sim cycle
|
||||
computed/video frame rendered.
|
||||
This routine returns a counter starting at zero for each sim cycle
|
||||
computed/video frame rendered.
|
||||
}
|
||||
FUNCTION XPLMGetCycleNumber: integer;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
FUNCTION XPLMGetCycleNumber: Integer;
|
||||
cdecl; external XPLM_DLL;
|
||||
|
||||
{
|
||||
XPLMRegisterFlightLoopCallback
|
||||
|
||||
This routine registers your flight loop callback. Pass in a pointer to a
|
||||
flight loop function and a refcon. inInterval defines when you will be
|
||||
called. Pass in a positive number to specify seconds from registration
|
||||
time to the next callback. Pass in a negative number to indicate when you
|
||||
will be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to
|
||||
not be called; your callback will be inactive.
|
||||
This routine registers your flight loop callback. Pass in a pointer to a
|
||||
flight loop function and a refcon. inInterval defines when you will be
|
||||
called. Pass in a positive number to specify seconds from registration time
|
||||
to the next callback. Pass in a negative number to indicate when you will
|
||||
be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to not be
|
||||
called; your callback will be inactive.
|
||||
|
||||
(This legacy function only installs pre-flight-loop callbacks; use
|
||||
XPLMCreateFlightLoop for more control.)
|
||||
}
|
||||
PROCEDURE XPLMRegisterFlightLoopCallback(
|
||||
inFlightLoop : XPLMFlightLoop_f;
|
||||
inInterval : single;
|
||||
inInterval : Single;
|
||||
inRefcon : pointer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPLM_DLL;
|
||||
|
||||
{
|
||||
XPLMUnregisterFlightLoopCallback
|
||||
|
||||
This routine unregisters your flight loop callback. Do NOT call it from
|
||||
your flight loop callback. Once your flight loop callback is
|
||||
unregistered, it will not be called again.
|
||||
This routine unregisters your flight loop callback. Do NOT call it from
|
||||
your flight loop callback. Once your flight loop callback is unregistered,
|
||||
it will not be called again.
|
||||
|
||||
Only use this on flight loops registered via
|
||||
XPLMRegisterFlightLoopCallback.
|
||||
}
|
||||
PROCEDURE XPLMUnregisterFlightLoopCallback(
|
||||
inFlightLoop : XPLMFlightLoop_f;
|
||||
inRefcon : pointer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPLM_DLL;
|
||||
|
||||
{
|
||||
XPLMSetFlightLoopCallbackInterval
|
||||
|
||||
This routine sets when a callback will be called. Do NOT call it from your
|
||||
callback; use the return value of the callback to change your callback
|
||||
interval from inside your callback.
|
||||
This routine sets when a callback will be called. Do NOT call it from your
|
||||
callback; use the return value of the callback to change your callback
|
||||
interval from inside your callback.
|
||||
|
||||
inInterval is formatted the same way as in XPLMRegisterFlightLoopCallback;
|
||||
positive for seconds, negative for cycles, and 0 for deactivating the
|
||||
callback. If inRelativeToNow is 1, times are from the time of this call;
|
||||
otherwise they are from the time the callback was last called (or the time
|
||||
it was registered if it has never been called.
|
||||
inInterval is formatted the same way as in XPLMRegisterFlightLoopCallback;
|
||||
positive for seconds, negative for cycles, and 0 for deactivating the
|
||||
callback. If inRelativeToNow is 1, times are from the time of this call;
|
||||
otherwise they are from the time the callback was last called (or the time
|
||||
it was registered if it has never been called.
|
||||
}
|
||||
PROCEDURE XPLMSetFlightLoopCallbackInterval(
|
||||
inFlightLoop : XPLMFlightLoop_f;
|
||||
inInterval : single;
|
||||
inRelativeToNow : integer;
|
||||
inInterval : Single;
|
||||
inRelativeToNow : Integer;
|
||||
inRefcon : pointer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
cdecl; external XPLM_DLL;
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMCreateFlightLoop
|
||||
|
||||
This routine creates a flight loop callback and returns its ID. The flight
|
||||
loop callback is created using the input param struct, and is inited to be
|
||||
unscheduled.
|
||||
This routine creates a flight loop callback and returns its ID. The flight
|
||||
loop callback is created using the input param struct, and is inited to be
|
||||
unscheduled.
|
||||
}
|
||||
FUNCTION XPLMCreateFlightLoop(
|
||||
inParams : PXPLMCreateFlightLoop_t) : XPLMFlightLoopID;
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
cdecl; external XPLM_DLL;
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMDestroyFlightLoop
|
||||
|
||||
This routine destroys a flight loop callback by ID.
|
||||
This routine destroys a flight loop callback by ID. Only call it on flight
|
||||
loops created with the newer XPLMCreateFlightLoop API.
|
||||
}
|
||||
PROCEDURE XPLMDestroyFlightLoop(
|
||||
inFlightLoopID : XPLMFlightLoopID);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
cdecl; external XPLM_DLL;
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
{$IFDEF XPLM210}
|
||||
{
|
||||
XPLMScheduleFlightLoop
|
||||
|
||||
This routine schedules a flight loop callback for future execution. If
|
||||
inInterval is negative, it is run in a certain number of frames based on
|
||||
the absolute value of the input. If the interval is positive, it is a
|
||||
duration in seconds.
|
||||
This routine schedules a flight loop callback for future execution. If
|
||||
inInterval is negative, it is run in a certain number of frames based on
|
||||
the absolute value of the input. If the interval is positive, it is a
|
||||
duration in seconds.
|
||||
|
||||
If inRelativeToNow is true, ties are interpretted relative to the time this
|
||||
routine is called; otherwise they are relative to the last call time or the
|
||||
time the flight loop was registered (if never called).
|
||||
|
||||
THREAD SAFETY: it is legal to call this routine from any thread under the
|
||||
following conditions:
|
||||
|
||||
1. The call must be between the beginning of an XPLMEnable and the end of
|
||||
an XPLMDisable sequence. (That is, you must not call this routine from
|
||||
thread activity when your plugin was supposed to be disabled. Since
|
||||
plugins are only enabled while loaded, this also implies you cannot run
|
||||
this routine outside an XPLMStart/XPLMStop sequence.)
|
||||
|
||||
2. You may not call this routine re-entrantly for a single flight loop ID.
|
||||
(That is, you can't enable from multiple threads at the same time.)
|
||||
|
||||
3. You must call this routine between the time after XPLMCreateFlightLoop
|
||||
returns a value and the time you call XPLMDestroyFlightLoop. (That is, you
|
||||
must ensure that your threaded activity is within the life of the object.
|
||||
The SDK does not check this for you, nor does it synchronize destruction of
|
||||
the object.)
|
||||
|
||||
4. The object must be unscheduled if this routine is to be called from a
|
||||
thread other than the main thread.
|
||||
If inRelativeToNow is true, ties are interpretted relative to the time this
|
||||
routine is called; otherwise they are relative to the last call time or the
|
||||
time the flight loop was registered (if never called).
|
||||
}
|
||||
PROCEDURE XPLMScheduleFlightLoop(
|
||||
inFlightLoopID : XPLMFlightLoopID;
|
||||
inInterval : single;
|
||||
inRelativeToNow : integer);
|
||||
{$IFDEF DELPHI}
|
||||
cdecl; external 'XPLM.DLL';
|
||||
{$ELSE}
|
||||
cdecl; external '';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
inInterval : Single;
|
||||
inRelativeToNow : Integer);
|
||||
cdecl; external XPLM_DLL;
|
||||
{$ENDIF XPLM210}
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
END.
|
||||
Reference in new issue
Block a user