mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
clang-format src
This commit is contained in:
@@ -2,56 +2,57 @@
|
||||
#define _FSUIPC_H_
|
||||
|
||||
// Supported Sims
|
||||
#define SIM_ANY 0
|
||||
#define SIM_FS98 1
|
||||
#define SIM_FS2K 2
|
||||
#define SIM_CFS2 3
|
||||
#define SIM_CFS1 4
|
||||
#define SIM_FLY 5
|
||||
#define SIM_FS2K2 6
|
||||
#define SIM_FS2K4 7
|
||||
#define SIM_FSX 8
|
||||
#define SIM_ESP 9
|
||||
#define SIM_P3D 10
|
||||
#define SIM_ANY 0
|
||||
#define SIM_FS98 1
|
||||
#define SIM_FS2K 2
|
||||
#define SIM_CFS2 3
|
||||
#define SIM_CFS1 4
|
||||
#define SIM_FLY 5
|
||||
#define SIM_FS2K2 6
|
||||
#define SIM_FS2K4 7
|
||||
#define SIM_FSX 8
|
||||
#define SIM_ESP 9
|
||||
#define SIM_P3D 10
|
||||
|
||||
// Error numbers
|
||||
#define FSUIPC_ERR_OK 0
|
||||
#define FSUIPC_ERR_OPEN 1 // Attempt to Open when already Open
|
||||
#define FSUIPC_ERR_NOFS 2 // Cannot link to FSUIPC or WideClient
|
||||
#define FSUIPC_ERR_REGMSG 3 // Failed to Register common message with Windows
|
||||
#define FSUIPC_ERR_ATOM 4 // Failed to create Atom for mapping filename
|
||||
#define FSUIPC_ERR_MAP 5 // Failed to create a file mapping object
|
||||
#define FSUIPC_ERR_VIEW 6 // Failed to open a view to the file map
|
||||
#define FSUIPC_ERR_VERSION 7 // Incorrect version of FSUIPC, or not FSUIPC
|
||||
#define FSUIPC_ERR_WRONGFS 8 // Sim is not version requested
|
||||
#define FSUIPC_ERR_NOTOPEN 9 // Call cannot execute, link not Open
|
||||
#define FSUIPC_ERR_NODATA 10 // Call cannot execute: no requests accumulated
|
||||
#define FSUIPC_ERR_TIMEOUT 11 // IPC timed out all retries
|
||||
#define FSUIPC_ERR_SENDMSG 12 // IPC sendmessage failed all retries
|
||||
#define FSUIPC_ERR_DATA 13 // IPC request contains bad data
|
||||
#define FSUIPC_ERR_RUNNING 14 // Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC
|
||||
#define FSUIPC_ERR_SIZE 15 // Read or Write request cannot be added, memory for Process is full
|
||||
#define FSUIPC_ERR_OK 0
|
||||
#define FSUIPC_ERR_OPEN 1 // Attempt to Open when already Open
|
||||
#define FSUIPC_ERR_NOFS 2 // Cannot link to FSUIPC or WideClient
|
||||
#define FSUIPC_ERR_REGMSG 3 // Failed to Register common message with Windows
|
||||
#define FSUIPC_ERR_ATOM 4 // Failed to create Atom for mapping filename
|
||||
#define FSUIPC_ERR_MAP 5 // Failed to create a file mapping object
|
||||
#define FSUIPC_ERR_VIEW 6 // Failed to open a view to the file map
|
||||
#define FSUIPC_ERR_VERSION 7 // Incorrect version of FSUIPC, or not FSUIPC
|
||||
#define FSUIPC_ERR_WRONGFS 8 // Sim is not version requested
|
||||
#define FSUIPC_ERR_NOTOPEN 9 // Call cannot execute, link not Open
|
||||
#define FSUIPC_ERR_NODATA 10 // Call cannot execute: no requests accumulated
|
||||
#define FSUIPC_ERR_TIMEOUT 11 // IPC timed out all retries
|
||||
#define FSUIPC_ERR_SENDMSG 12 // IPC sendmessage failed all retries
|
||||
#define FSUIPC_ERR_DATA 13 // IPC request contains bad data
|
||||
#define FSUIPC_ERR_RUNNING 14 // Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC
|
||||
#define FSUIPC_ERR_SIZE 15 // Read or Write request cannot be added, memory for Process is full
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Globals accessible from main code
|
||||
extern DWORD FSUIPC_Version; // HIWORD is 1000 x Version Number, minimum 1998
|
||||
// LOWORD is build letter, with a = 1 etc. For 1998 this must be at least 5 (1998e)
|
||||
extern DWORD FSUIPC_FS_Version;
|
||||
// FS98=1, FS2k=2, CFS2=3. See above.
|
||||
extern DWORD FSUIPC_Lib_Version;
|
||||
// HIWORD is 1000 x version, LOWORD is build letter, a = 1 etc.
|
||||
// Globals accessible from main code
|
||||
extern DWORD FSUIPC_Version; // HIWORD is 1000 x Version Number, minimum 1998
|
||||
// LOWORD is build letter, with a = 1 etc. For 1998 this must be at least 5 (1998e)
|
||||
extern DWORD FSUIPC_FS_Version;
|
||||
// FS98=1, FS2k=2, CFS2=3. See above.
|
||||
extern DWORD FSUIPC_Lib_Version;
|
||||
// HIWORD is 1000 x version, LOWORD is build letter, a = 1 etc.
|
||||
|
||||
// Library routines
|
||||
extern BOOL FSUIPC_Open(DWORD dwFSReq, DWORD *pdwResult); // For use externally (IPCuser.lib)
|
||||
extern BOOL FSUIPC_Open2(DWORD dwFSReq, DWORD *pdwResult, BYTE *pMem, DWORD dwSize); // For use internally (ModuleUser.lib)
|
||||
extern void FSUIPC_Close(void);
|
||||
extern BOOL FSUIPC_Read(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_ReadSpecial(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_Process(DWORD *pdwResult);
|
||||
// Library routines
|
||||
extern BOOL FSUIPC_Open(DWORD dwFSReq, DWORD *pdwResult); // For use externally (IPCuser.lib)
|
||||
extern BOOL FSUIPC_Open2(DWORD dwFSReq, DWORD *pdwResult, BYTE *pMem, DWORD dwSize); // For use internally (ModuleUser.lib)
|
||||
extern void FSUIPC_Close(void);
|
||||
extern BOOL FSUIPC_Read(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_ReadSpecial(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);
|
||||
extern BOOL FSUIPC_Process(DWORD *pdwResult);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
#include "FSUIPC_User.h"
|
||||
|
||||
#define FS6IPC_MSGNAME1 L"FsasmLib:IPC"
|
||||
#define FS6IPC_MSGNAME1 L"FsasmLib:IPC"
|
||||
|
||||
#define FS6IPC_MESSAGE_SUCCESS 1
|
||||
#define FS6IPC_MESSAGE_FAILURE 0
|
||||
|
||||
// IPC message types
|
||||
#define FS6IPC_READSTATEDATA_ID 1
|
||||
#define FS6IPC_WRITESTATEDATA_ID 2
|
||||
#define FS6IPC_READSTATEDATA_ID 1
|
||||
#define FS6IPC_WRITESTATEDATA_ID 2
|
||||
|
||||
// read request structure
|
||||
typedef struct tagFS6IPC_READSTATEDATA_HDR
|
||||
{
|
||||
DWORD dwId; // FS6IPC_READSTATEDATA_ID
|
||||
DWORD dwOffset; // state table offset
|
||||
DWORD nBytes; // number of bytes of state data to read
|
||||
void* pDest; // destination buffer for data (client use only)
|
||||
DWORD dwId; // FS6IPC_READSTATEDATA_ID
|
||||
DWORD dwOffset; // state table offset
|
||||
DWORD nBytes; // number of bytes of state data to read
|
||||
void *pDest; // destination buffer for data (client use only)
|
||||
} FS6IPC_READSTATEDATA_HDR;
|
||||
|
||||
// write request structure
|
||||
typedef struct tagFS6IPC_WRITESTATEDATA_HDR
|
||||
{
|
||||
DWORD dwId; // FS6IPC_WRITESTATEDATA_ID
|
||||
DWORD dwOffset; // state table offset
|
||||
DWORD nBytes; // number of bytes of state data to write
|
||||
DWORD dwId; // FS6IPC_WRITESTATEDATA_ID
|
||||
DWORD dwOffset; // state table offset
|
||||
DWORD nBytes; // number of bytes of state data to write
|
||||
} FS6IPC_WRITESTATEDATA_HDR;
|
||||
|
||||
@@ -1,84 +1,90 @@
|
||||
// Wind structure (size 16 bytes)
|
||||
typedef struct _NewWind
|
||||
{ unsigned short UpperAlt; // Metres
|
||||
unsigned short Speed; // Knots
|
||||
unsigned short Gust; // Max gust speed difference, knots
|
||||
unsigned short Direction; // usual 65536 = 360 units
|
||||
unsigned char Turbulence; // 0-4
|
||||
unsigned char Shear; // 0-3
|
||||
unsigned short Variance; // direction variability, same units as Direction
|
||||
unsigned short SpeedFract; // 1/65536ths of Knots, for more accurate vector calcs
|
||||
unsigned short GapAbove; // Metres
|
||||
// This is the gap from the top of surface altitude to first layer's base
|
||||
// GapAbove is ignored in layers other than the surface layer, and needs
|
||||
// FSUIC 4.748 or 3.998k minimum.
|
||||
{
|
||||
unsigned short UpperAlt; // Metres
|
||||
unsigned short Speed; // Knots
|
||||
unsigned short Gust; // Max gust speed difference, knots
|
||||
unsigned short Direction; // usual 65536 = 360 units
|
||||
unsigned char Turbulence; // 0-4
|
||||
unsigned char Shear; // 0-3
|
||||
unsigned short Variance; // direction variability, same units as Direction
|
||||
unsigned short SpeedFract; // 1/65536ths of Knots, for more accurate vector calcs
|
||||
unsigned short GapAbove; // Metres
|
||||
// This is the gap from the top of surface altitude to first layer's base
|
||||
// GapAbove is ignored in layers other than the surface layer, and needs
|
||||
// FSUIC 4.748 or 3.998k minimum.
|
||||
} NewWind;
|
||||
|
||||
// Visibility structure (size 8 bytes)
|
||||
typedef struct _NewVis
|
||||
{ unsigned short UpperAlt; // Metres
|
||||
signed short LowerAlt; // Metres
|
||||
unsigned short Range; // in 1/100ths sm
|
||||
unsigned short Spare;
|
||||
{
|
||||
unsigned short UpperAlt; // Metres
|
||||
signed short LowerAlt; // Metres
|
||||
unsigned short Range; // in 1/100ths sm
|
||||
unsigned short Spare;
|
||||
} NewVis;
|
||||
|
||||
// Cloud structure (size 16 bytes)
|
||||
typedef struct _NewCloud
|
||||
{ unsigned short UpperAlt; // Metres
|
||||
unsigned short LowerAlt; // Metres
|
||||
unsigned short Deviation; // Metres
|
||||
unsigned char Coverage; // Octas, 0-8
|
||||
unsigned char Type; // 1-10
|
||||
unsigned char Turbulence; // 0-4
|
||||
unsigned char Icing; // 0-4
|
||||
signed short PrecipBase; // Metres
|
||||
unsigned char PrecipType; // 0-2
|
||||
unsigned char PrecipRate; // 0-5
|
||||
unsigned char TopShape; // ?
|
||||
unsigned char Spare;
|
||||
{
|
||||
unsigned short UpperAlt; // Metres
|
||||
unsigned short LowerAlt; // Metres
|
||||
unsigned short Deviation; // Metres
|
||||
unsigned char Coverage; // Octas, 0-8
|
||||
unsigned char Type; // 1-10
|
||||
unsigned char Turbulence; // 0-4
|
||||
unsigned char Icing; // 0-4
|
||||
signed short PrecipBase; // Metres
|
||||
unsigned char PrecipType; // 0-2
|
||||
unsigned char PrecipRate; // 0-5
|
||||
unsigned char TopShape; // ?
|
||||
unsigned char Spare;
|
||||
} NewCloud;
|
||||
|
||||
// Temperature structure (size 8 bytes)
|
||||
typedef struct _NewTemp
|
||||
{ unsigned short Alt; // Metres
|
||||
short Day; // Degrees C
|
||||
short DayNightVar; // Degrees C
|
||||
short DewPoint; // Degrees C
|
||||
{
|
||||
unsigned short Alt; // Metres
|
||||
short Day; // Degrees C
|
||||
short DayNightVar; // Degrees C
|
||||
short DewPoint; // Degrees C
|
||||
} NewTemp;
|
||||
|
||||
// Pressure structure (size 4 bytes)
|
||||
typedef struct _NewPress
|
||||
{ unsigned short Pressure; // 16 x mb
|
||||
short Drift; // ? Maybe
|
||||
{
|
||||
unsigned short Pressure; // 16 x mb
|
||||
short Drift; // ? Maybe
|
||||
} NewPress;
|
||||
|
||||
// Structure mapped to FSUIPC offsets
|
||||
// C000, C400, C800 and CC00
|
||||
typedef struct _NewWeather
|
||||
{ unsigned short uCommand; // C000 C400 C800 CC00
|
||||
unsigned short uFlags; // C002 C402 C802 CC02 // Not used until FSX - see below
|
||||
unsigned int ulSignature; // C004 C404 C804 CC04
|
||||
char chICAO[4]; // C008 C408 C808 CC08
|
||||
unsigned short uDynamics; // C00C C40C C80C CC0C // 0=none, 4=extreme
|
||||
unsigned short uSeconds; // C00E C40E C80E CC0E // FSX only -- see below
|
||||
double dLatitude; // C010 C410 C810 CC10 // LLA zero for GLOB or unknown ICAO
|
||||
double dLongitude; // C018 C418 C818 CC18
|
||||
int nElevation; // C020 C420 C820 CC20 // metres * 65536
|
||||
unsigned int ulTimeStamp; // C024 C424 C824 CC24 // mSecs since start of session
|
||||
NewPress Press; // C028 C428 C828 CC28
|
||||
NewVis Vis; // C02C C42C C82C CC2C // Base Vis -- for upper Vis layers see
|
||||
int nTempCtr; // C034 C434 C834 CC34 // Number of temperature layers
|
||||
NewTemp Temp[24]; // C038 C438 C838 CC38
|
||||
int nWindsCtr; // C0F8 C4F8 C8F8 CCF8 // Number of wind layers
|
||||
NewWind Wind[24]; // C0FC C4FC C8FC CCFC
|
||||
int nCloudsCtr; // C27C C67C CA7C CE7C // Number of Cloud layers (max 16 in FSX, was 24
|
||||
NewCloud Cloud[16]; // C280 C680 CA80 CE80
|
||||
char chUTCstamp[6]; // C380 C780 CB80 CF80 // UTC time stamp on METAR (internal use)
|
||||
unsigned short fWriteback; // C386 C786 CB86 CF86 // Flags for writing back to FSX (internal use only)
|
||||
unsigned long ulSettingTimeStamp; // C388 c788 CB88 CF88 // Timestamp METAR sent (internal use)
|
||||
int nUpperVisCtr; // C38C C78C CB8C CF8C // Number of upper Vis layer (new in FSX)
|
||||
NewVis UpperVis[12]; // C390 C790 CB90 CF90
|
||||
unsigned short uSpare[8]; // C3F0 C7F0 CBF0 CFF0
|
||||
{
|
||||
unsigned short uCommand; // C000 C400 C800 CC00
|
||||
unsigned short uFlags; // C002 C402 C802 CC02 // Not used until FSX - see below
|
||||
unsigned int ulSignature; // C004 C404 C804 CC04
|
||||
char chICAO[4]; // C008 C408 C808 CC08
|
||||
unsigned short uDynamics; // C00C C40C C80C CC0C // 0=none, 4=extreme
|
||||
unsigned short uSeconds; // C00E C40E C80E CC0E // FSX only -- see below
|
||||
double dLatitude; // C010 C410 C810 CC10 // LLA zero for GLOB or unknown ICAO
|
||||
double dLongitude; // C018 C418 C818 CC18
|
||||
int nElevation; // C020 C420 C820 CC20 // metres * 65536
|
||||
unsigned int ulTimeStamp; // C024 C424 C824 CC24 // mSecs since start of session
|
||||
NewPress Press; // C028 C428 C828 CC28
|
||||
NewVis Vis; // C02C C42C C82C CC2C // Base Vis -- for upper Vis layers see
|
||||
int nTempCtr; // C034 C434 C834 CC34 // Number of temperature layers
|
||||
NewTemp Temp[24]; // C038 C438 C838 CC38
|
||||
int nWindsCtr; // C0F8 C4F8 C8F8 CCF8 // Number of wind layers
|
||||
NewWind Wind[24]; // C0FC C4FC C8FC CCFC
|
||||
int nCloudsCtr; // C27C C67C CA7C CE7C // Number of Cloud layers (max 16 in FSX, was 24
|
||||
NewCloud Cloud[16]; // C280 C680 CA80 CE80
|
||||
char chUTCstamp[6]; // C380 C780 CB80 CF80 // UTC time stamp on METAR (internal use)
|
||||
unsigned short fWriteback; // C386 C786 CB86 CF86 // Flags for writing back to FSX (internal use only)
|
||||
unsigned long ulSettingTimeStamp; // C388 c788 CB88 CF88 // Timestamp METAR sent (internal use)
|
||||
int nUpperVisCtr; // C38C C78C CB8C CF8C // Number of upper Vis layer (new in FSX)
|
||||
NewVis UpperVis[12]; // C390 C790 CB90 CF90
|
||||
unsigned short uSpare[8]; // C3F0 C7F0 CBF0 CFF0
|
||||
} NewWeather;
|
||||
|
||||
#define MAXVISLAYERS 12
|
||||
@@ -87,10 +93,10 @@ typedef struct _NewWeather
|
||||
#define MAXCLOUDLAYERS 16
|
||||
|
||||
// Commands (for set weather area only)
|
||||
#define NW_SET 1 // Set weather via FSUIPC user filters
|
||||
#define NW_SETEXACT 2 // Set weather bypassing user filters
|
||||
#define NW_CLEAR 3 // Clear all weather, but leave dynamic setting alone
|
||||
#define NW_DYNAMICS 4 // Set weather dynamics (from uDynamics value)
|
||||
#define NW_SET 1 // Set weather via FSUIPC user filters
|
||||
#define NW_SETEXACT 2 // Set weather bypassing user filters
|
||||
#define NW_CLEAR 3 // Clear all weather, but leave dynamic setting alone
|
||||
#define NW_DYNAMICS 4 // Set weather dynamics (from uDynamics value)
|
||||
#define NW_GLOBAL 5 // (FSX) Put FS into Global weather mode
|
||||
// You sohuld write only 'GLOB' weather after this, which will be applied everywhere.
|
||||
|
||||
@@ -105,7 +111,7 @@ typedef struct _NewWeather
|
||||
#define NWF_SECONDS 1
|
||||
/* Set this flag if "Seconds" value is to be used in setting weather in FSX
|
||||
This applies to weather set via NWI values or via the NEXT Metar string
|
||||
written to B000. It's a "one shot" flag, cleared after use.
|
||||
written to B000. It's a "one shot" flag, cleared after use.
|
||||
|
||||
The Seconds value determines whether the weather change is effective
|
||||
immediately or after a delay, gradually "blending" into the existing
|
||||
@@ -117,4 +123,3 @@ typedef struct _NewWeather
|
||||
// C400 - read only, maintains last written global weather values
|
||||
// C800 - write area to set weather according to Command, flags, etc etc.
|
||||
// CC00 - selected read (via signature + ICAO), reads weather at weather station or GLOB
|
||||
|
||||
|
||||
Reference in New Issue
Block a user