Skip to content

Commit

Permalink
Merge pull request #24 from tcavenezuela/feat/new-simulator-offsets
Browse files Browse the repository at this point in the history
chore: add new misc offsets (simulator related)
  • Loading branch information
carl0shd authored Jul 2, 2024
2 parents 5885a1c + 886ec28 commit eccde0c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .changeset/wise-yaks-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@fsuipc.js/api': patch
---

add offset 0x3308: sim version currently in use.
add offset 0x3d00: aircraft name currently in use.
add exclusive X-Plane offset 0x6fff: flag to indicate if the fsuipc version is currently running in X-Plane (XPUIPC).
add exclusive X-Plane offset 0x6f03: XPUIPC version string.
3 changes: 2 additions & 1 deletion packages/api/src/shared/offset-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export enum OffsetCategory {
RADIOS = 'radios',
RUNWAY = 'runway',
SIMULATION = 'simulation',
WEATHER = 'weather'
WEATHER = 'weather',
MISC = 'misc'
}
7 changes: 6 additions & 1 deletion packages/api/src/utils/offsets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { engines } from './plane/engines';
import { autopilot } from './plane/autopilot';
import { failure } from './failure/failure';
import { electric } from './plane/electric';
import { simulator } from './misc/simulator';

export const OFFSETS: OffsetList = {
// Position and Attitude
Expand Down Expand Up @@ -48,7 +49,10 @@ export const OFFSETS: OffsetList = {
...icing,
...engines,
...autopilot,
...electric
...electric,

// Misc
...simulator
};

export * from './airport/runway';
Expand All @@ -68,3 +72,4 @@ export * from './plane/engines';
export * from './plane/autopilot';
export * from './simulation/simulation';
export * from './plane/electric';
export * from './misc/simulator';
43 changes: 43 additions & 0 deletions packages/api/src/utils/offsets/misc/simulator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Type } from 'fsuipc.js';

import { OffsetCategory } from '@shared/offset-category';
import { OffsetList } from '@shared/offset-list';
import { Offset } from '@shared/offset';

export const simulator: OffsetList = {
fsVersion: new Offset({
value: 0x3308,
name: 'fsVersion',
category: OffsetCategory.MISC,
description: 'sim version currently in use',
type: Type.UInt16,
permission: 'r'
}),
aircraftTitle: new Offset({
value: 0x3d00,
name: 'aircraftTitle',
category: OffsetCategory.MISC,
description: 'aircraft name currently in use',
type: Type.String,
length: 256,
permission: 'r'
}),
/* XPUIPC offsets */
xplaneFlag: new Offset({
value: 0x6fff,
name: 'xplaneFlag',
category: OffsetCategory.MISC,
description: 'flag to indicate if the fsuipc version is currently running in X-Plane (XPUIPC)',
type: Type.Byte,
permission: 'r'
}),
xpuipcVersion: new Offset({
value: 0x6f03,
name: 'xpuipcVersion',
category: OffsetCategory.MISC,
description: 'XPUIPC version string',
type: Type.String,
length: 256,
permission: 'r'
})
};

0 comments on commit eccde0c

Please sign in to comment.