├── .gitignore ├── CMakeLists.txt ├── GL_for_Windows ├── dll │ ├── glu32.dll │ ├── glut32.dll │ └── opengl32.dll ├── include │ └── GL │ │ ├── GL.H │ │ ├── GLAux.h │ │ ├── GLU.H │ │ ├── glui.h │ │ └── glut.h └── lib │ ├── glaux.lib │ ├── glu32.lib │ ├── glui32.lib │ ├── glut32.lib │ └── opengl32.lib ├── INTEGRATION.md ├── OpenAL ├── include │ ├── EFX-Util.h │ ├── al.h │ ├── alc.h │ ├── efx-creative.h │ ├── efx.h │ └── xram.h └── libs │ ├── Win32 │ ├── EFX-Util_MT │ │ └── EFX-Util.lib │ ├── EFX-Util_MTDLL │ │ └── EFX-Util.lib │ └── OpenAL32.lib │ └── Win64 │ ├── EFX-Util_MT │ └── EFX-Util.lib │ ├── EFX-Util_MTDLL │ └── EFX-Util.lib │ └── OpenAL32.lib ├── README.md ├── SDK ├── CHeaders │ ├── Widgets │ │ ├── XPStandardWidgets.h │ │ ├── XPUIGraphics.h │ │ ├── XPWidgetDefs.h │ │ ├── XPWidgetUtils.h │ │ └── XPWidgets.h │ ├── Wrappers │ │ ├── XPCBroadcaster.cpp │ │ ├── XPCBroadcaster.h │ │ ├── XPCDisplay.cpp │ │ ├── XPCDisplay.h │ │ ├── XPCListener.cpp │ │ ├── XPCListener.h │ │ ├── XPCProcessing.cpp │ │ ├── XPCProcessing.h │ │ ├── XPCWidget.cpp │ │ ├── XPCWidget.h │ │ ├── XPCWidgetAttachments.cpp │ │ └── XPCWidgetAttachments.h │ └── XPLM │ │ ├── XPLMCamera.h │ │ ├── XPLMDataAccess.h │ │ ├── XPLMDefs.h │ │ ├── XPLMDisplay.h │ │ ├── XPLMGraphics.h │ │ ├── XPLMInstance.h │ │ ├── XPLMMap.h │ │ ├── XPLMMenus.h │ │ ├── XPLMNavigation.h │ │ ├── XPLMPlanes.h │ │ ├── XPLMPlugin.h │ │ ├── XPLMProcessing.h │ │ ├── XPLMScenery.h │ │ └── XPLMUtilities.h ├── Delphi │ ├── Widgets │ │ ├── XPStandardWidgets.pas │ │ ├── XPUIGraphics.pas │ │ ├── XPWidgetDefs.pas │ │ ├── XPWidgetUtils.pas │ │ └── XPWidgets.pas │ └── XPLM │ │ ├── XPLMCamera.pas │ │ ├── XPLMDataAccess.pas │ │ ├── XPLMDefs.pas │ │ ├── XPLMDisplay.pas │ │ ├── XPLMGraphics.pas │ │ ├── XPLMInstance.pas │ │ ├── XPLMMap.pas │ │ ├── XPLMMenus.pas │ │ ├── XPLMNavigation.pas │ │ ├── XPLMPlanes.pas │ │ ├── XPLMPlugin.pas │ │ ├── XPLMProcessing.pas │ │ ├── XPLMScenery.pas │ │ └── XPLMUtilities.pas ├── FF_A320 │ ├── SharedValue.h │ └── TCAS_obj_intf.txt ├── Libraries │ ├── Mac │ │ ├── XPLM.framework │ │ │ └── XPLM │ │ └── XPWidgets.framework │ │ │ └── XPWidgets │ └── Win │ │ ├── XPLM_64.lib │ │ └── XPWidgets_64.lib ├── README.txt └── license.txt ├── X-TCAS.cfg ├── build_release ├── fonts └── RobotoCondensed-Regular.ttf ├── gts820 ├── 10clk.aup ├── 10clk.wav ├── 10clk_data │ └── e00 │ │ └── d00 │ │ └── e0000440.au ├── 10nm.aup ├── 10nm.wav ├── 10nm_data │ └── e00 │ │ └── d00 │ │ └── e0000cc1.au ├── 11clk.aup ├── 11clk.wav ├── 11clk_data │ └── e00 │ │ └── d00 │ │ └── e0000954.au ├── 12clk.aup ├── 12clk.wav ├── 12clk_data │ └── e00 │ │ └── d00 │ │ └── e000067e.au ├── 1clk.aup ├── 1clk.wav ├── 1clk_data │ └── e00 │ │ └── d00 │ │ └── e0000dc1.au ├── 1nm.aup ├── 1nm.wav ├── 1nm_data │ └── e00 │ │ └── d00 │ │ └── e0000739.au ├── 2clk.aup ├── 2clk.wav ├── 2clk_data │ └── e00 │ │ └── d00 │ │ └── e0000d5f.au ├── 2nm.aup ├── 2nm.wav ├── 2nm_data │ └── e00 │ │ └── d00 │ │ └── e0000fa1.au ├── 3clk.aup ├── 3clk.wav ├── 3clk_data │ └── e00 │ │ └── d00 │ │ └── e0000340.au ├── 3nm.aup ├── 3nm.wav ├── 3nm_data │ └── e00 │ │ └── d00 │ │ └── e0000bda.au ├── 4clk.aup ├── 4clk.wav ├── 4clk_data │ └── e00 │ │ └── d00 │ │ └── e0000c44.au ├── 4nm.aup ├── 4nm.wav ├── 4nm_data │ └── e00 │ │ └── d00 │ │ └── e0000de6.au ├── 5clk.aup ├── 5clk.wav ├── 5clk_data │ └── e00 │ │ └── d00 │ │ └── e0000454.au ├── 5nm.aup ├── 5nm.wav ├── 5nm_data │ └── e00 │ │ └── d00 │ │ └── e0000300.au ├── 6clk.aup ├── 6clk.wav ├── 6clk_data │ └── e00 │ │ └── d00 │ │ └── e0000d09.au ├── 6nm.aup ├── 6nm.wav ├── 6nm_data │ └── e00 │ │ └── d00 │ │ └── e0000a09.au ├── 7clk.aup ├── 7clk.wav ├── 7clk_data │ └── e00 │ │ └── d00 │ │ └── e0000fac.au ├── 7nm.aup ├── 7nm.wav ├── 7nm_data │ └── e00 │ │ └── d00 │ │ └── e0000eac.au ├── 8clk.aup ├── 8clk.wav ├── 8clk_data │ └── e00 │ │ └── d00 │ │ └── e00008b4.au ├── 8nm.aup ├── 8nm.wav ├── 8nm_data │ └── e00 │ │ └── d00 │ │ └── e000005a.au ├── 9clk.aup ├── 9clk.wav ├── 9clk_data │ └── e00 │ │ └── d00 │ │ └── e00000fb.au ├── 9nm.aup ├── 9nm.wav ├── 9nm_data │ └── e00 │ │ └── d00 │ │ └── e0000b73.au ├── alt_not_avail.aup ├── alt_not_avail.wav ├── alt_not_avail_data │ └── e00 │ │ └── d00 │ │ └── e0000054.au ├── cockpit_speaker ├── high.aup ├── high.wav ├── high_data │ └── e00 │ │ └── d00 │ │ └── e000087d.au ├── low.aup ├── low.wav ├── low_data │ └── e00 │ │ └── d00 │ │ └── e0000c6e.au ├── m1nm.aup ├── m1nm.wav ├── m1nm_data │ └── e00 │ │ └── d00 │ │ └── e0000e62.au ├── no_brg.wav ├── p10nm.aup ├── p10nm.wav ├── p10nm_data │ └── e00 │ │ └── d00 │ │ └── e0000aeb.au ├── same_alt.aup ├── same_alt.wav ├── same_alt_data │ └── e00 │ │ └── d00 │ │ └── e0000af8.au ├── tas.aup ├── tas_data │ └── e00 │ │ └── d00 │ │ ├── e00000cc.au │ │ ├── e000012a.au │ │ ├── e0000335.au │ │ ├── e0000646.au │ │ ├── e0000964.au │ │ ├── e0000a6f.au │ │ ├── e0000bdd.au │ │ ├── e0000c28.au │ │ ├── e0000d71.au │ │ └── e0000dda.au ├── tas_test_fail.wav ├── tas_test_pass.wav ├── tfc.aup ├── tfc.wav └── tfc_data │ └── e00 │ └── d00 │ └── e0000db1.au ├── images ├── vsi_example1.png └── vsi_example2.png ├── male1 ├── adjust_vs.wav ├── clb.wav ├── clb_cross.wav ├── clb_more.wav ├── clb_now.wav ├── clear.wav ├── des.wav ├── des_cross.wav ├── des_more.wav ├── des_now.wav ├── level_off.wav ├── maint_vs.wav ├── maint_vs_cross.wav ├── monitor_vs.wav ├── tcas_test_fail.wav ├── tcas_test_pass.wav └── tfc.wav ├── male2 ├── adjust_vs.wav ├── clb.wav ├── clb_cross.wav ├── clb_more.wav ├── clb_now.wav ├── clear.wav ├── des.wav ├── des_cross.wav ├── des_more.wav ├── des_now.wav ├── level_off.wav ├── maint_vs.wav ├── maint_vs_cross.wav ├── monitor_vs.wav ├── tcas_test_fail.wav ├── tcas_test_pass.wav └── tfc.wav ├── src ├── CMakeLists.txt ├── SL.c ├── SL.h ├── XCompile.cmake ├── dbg_log.c ├── dbg_log.h ├── ff_a320_intf.c ├── ff_a320_intf.h ├── generic_intf.c ├── pos.c ├── pos.h ├── snd_sys.c ├── snd_sys.h ├── symbols.version ├── test.c ├── test.h ├── vsi.c ├── vsi.h ├── xplane.c ├── xplane.h ├── xplane_test.c ├── xplane_test.h ├── xtcas.c └── xtcas.h └── xtcas └── generic_intf.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.o 3 | *.d 4 | bin 5 | CMakeCache.txt 6 | CMakeFiles 7 | Makefile 8 | cmake_install.cmake 9 | src/CMakeFiles 10 | src/Makefile 11 | src/cmake_install.cmake 12 | src/libX-TCAS.xpl.dll.a 13 | docs 14 | cmdfiles 15 | X-TCAS 16 | mac_x64 17 | lin_x64 18 | win_x64 19 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CDDL HEADER START 2 | # 3 | # This file and its contents are supplied under the terms of the 4 | # Common Development and Distribution License ("CDDL"), version 1.0. 5 | # You may only use this file in accordance with the terms of version 6 | # 1.0 of the CDDL. 7 | # 8 | # A full copy of the text of the CDDL should have accompanied this 9 | # source. A copy of the CDDL is also available via the Internet at 10 | # http://www.illumos.org/license/CDDL. 11 | # 12 | # CDDL HEADER END 13 | 14 | # Copyright 2016 Saso Kiselkov. All rights reserved. 15 | 16 | add_subdirectory(src) 17 | cmake_minimum_required(VERSION 2.8) 18 | -------------------------------------------------------------------------------- /GL_for_Windows/dll/glu32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/dll/glu32.dll -------------------------------------------------------------------------------- /GL_for_Windows/dll/glut32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/dll/glut32.dll -------------------------------------------------------------------------------- /GL_for_Windows/dll/opengl32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/dll/opengl32.dll -------------------------------------------------------------------------------- /GL_for_Windows/lib/glaux.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/lib/glaux.lib -------------------------------------------------------------------------------- /GL_for_Windows/lib/glu32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/lib/glu32.lib -------------------------------------------------------------------------------- /GL_for_Windows/lib/glui32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/lib/glui32.lib -------------------------------------------------------------------------------- /GL_for_Windows/lib/glut32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/lib/glut32.lib -------------------------------------------------------------------------------- /GL_for_Windows/lib/opengl32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/GL_for_Windows/lib/opengl32.lib -------------------------------------------------------------------------------- /OpenAL/include/efx-creative.h: -------------------------------------------------------------------------------- 1 | #ifndef __efxcreative_h_ 2 | #define __efxcreative_h_ 3 | 4 | /** 5 | * efx-creative.h - Environmental Audio Extensions 6 | * for OpenAL Effects Extension. 7 | * 8 | */ 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | /** 15 | * Effect object definitions to be used with alEffect functions. 16 | * 17 | * Effect parameter value definitions, ranges, and defaults 18 | * appear farther down in this file. 19 | */ 20 | 21 | /* AL EAXReverb effect parameters. */ 22 | #define AL_EAXREVERB_DENSITY 0x0001 23 | #define AL_EAXREVERB_DIFFUSION 0x0002 24 | #define AL_EAXREVERB_GAIN 0x0003 25 | #define AL_EAXREVERB_GAINHF 0x0004 26 | #define AL_EAXREVERB_GAINLF 0x0005 27 | #define AL_EAXREVERB_DECAY_TIME 0x0006 28 | #define AL_EAXREVERB_DECAY_HFRATIO 0x0007 29 | #define AL_EAXREVERB_DECAY_LFRATIO 0x0008 30 | #define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009 31 | #define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A 32 | #define AL_EAXREVERB_REFLECTIONS_PAN 0x000B 33 | #define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C 34 | #define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D 35 | #define AL_EAXREVERB_LATE_REVERB_PAN 0x000E 36 | #define AL_EAXREVERB_ECHO_TIME 0x000F 37 | #define AL_EAXREVERB_ECHO_DEPTH 0x0010 38 | #define AL_EAXREVERB_MODULATION_TIME 0x0011 39 | #define AL_EAXREVERB_MODULATION_DEPTH 0x0012 40 | #define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013 41 | #define AL_EAXREVERB_HFREFERENCE 0x0014 42 | #define AL_EAXREVERB_LFREFERENCE 0x0015 43 | #define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016 44 | #define AL_EAXREVERB_DECAY_HFLIMIT 0x0017 45 | 46 | /* Effect type definitions to be used with AL_EFFECT_TYPE. */ 47 | #define AL_EFFECT_EAXREVERB 0x8000 48 | 49 | 50 | 51 | /********************************************************** 52 | * Effect parameter structures, value definitions, ranges and defaults. 53 | */ 54 | 55 | /** 56 | * AL reverb effect parameter ranges and defaults 57 | */ 58 | #define AL_EAXREVERB_MIN_DENSITY 0.0f 59 | #define AL_EAXREVERB_MAX_DENSITY 1.0f 60 | #define AL_EAXREVERB_DEFAULT_DENSITY 1.0f 61 | 62 | #define AL_EAXREVERB_MIN_DIFFUSION 0.0f 63 | #define AL_EAXREVERB_MAX_DIFFUSION 1.0f 64 | #define AL_EAXREVERB_DEFAULT_DIFFUSION 1.0f 65 | 66 | #define AL_EAXREVERB_MIN_GAIN 0.0f 67 | #define AL_EAXREVERB_MAX_GAIN 1.0f 68 | #define AL_EAXREVERB_DEFAULT_GAIN 0.32f 69 | 70 | #define AL_EAXREVERB_MIN_GAINHF 0.0f 71 | #define AL_EAXREVERB_MAX_GAINHF 1.0f 72 | #define AL_EAXREVERB_DEFAULT_GAINHF 0.89f 73 | 74 | #define AL_EAXREVERB_MIN_GAINLF 0.0f 75 | #define AL_EAXREVERB_MAX_GAINLF 1.0f 76 | #define AL_EAXREVERB_DEFAULT_GAINLF 1.0f 77 | 78 | #define AL_EAXREVERB_MIN_DECAY_TIME 0.1f 79 | #define AL_EAXREVERB_MAX_DECAY_TIME 20.0f 80 | #define AL_EAXREVERB_DEFAULT_DECAY_TIME 1.49f 81 | 82 | #define AL_EAXREVERB_MIN_DECAY_HFRATIO 0.1f 83 | #define AL_EAXREVERB_MAX_DECAY_HFRATIO 2.0f 84 | #define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO 0.83f 85 | 86 | #define AL_EAXREVERB_MIN_DECAY_LFRATIO 0.1f 87 | #define AL_EAXREVERB_MAX_DECAY_LFRATIO 2.0f 88 | #define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO 1.0f 89 | 90 | #define AL_EAXREVERB_MIN_REFLECTIONS_GAIN 0.0f 91 | #define AL_EAXREVERB_MAX_REFLECTIONS_GAIN 3.16f 92 | #define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN 0.05f 93 | 94 | #define AL_EAXREVERB_MIN_REFLECTIONS_DELAY 0.0f 95 | #define AL_EAXREVERB_MAX_REFLECTIONS_DELAY 0.3f 96 | #define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY 0.007f 97 | 98 | #define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN {0.0f, 0.0f, 0.0f} 99 | 100 | #define AL_EAXREVERB_MIN_LATE_REVERB_GAIN 0.0f 101 | #define AL_EAXREVERB_MAX_LATE_REVERB_GAIN 10.0f 102 | #define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN 1.26f 103 | 104 | #define AL_EAXREVERB_MIN_LATE_REVERB_DELAY 0.0f 105 | #define AL_EAXREVERB_MAX_LATE_REVERB_DELAY 0.1f 106 | #define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY 0.011f 107 | 108 | #define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN {0.0f, 0.0f, 0.0f} 109 | 110 | #define AL_EAXREVERB_MIN_ECHO_TIME 0.075f 111 | #define AL_EAXREVERB_MAX_ECHO_TIME 0.25f 112 | #define AL_EAXREVERB_DEFAULT_ECHO_TIME 0.25f 113 | 114 | #define AL_EAXREVERB_MIN_ECHO_DEPTH 0.0f 115 | #define AL_EAXREVERB_MAX_ECHO_DEPTH 1.0f 116 | #define AL_EAXREVERB_DEFAULT_ECHO_DEPTH 0.0f 117 | 118 | #define AL_EAXREVERB_MIN_MODULATION_TIME 0.04f 119 | #define AL_EAXREVERB_MAX_MODULATION_TIME 4.0f 120 | #define AL_EAXREVERB_DEFAULT_MODULATION_TIME 0.25f 121 | 122 | #define AL_EAXREVERB_MIN_MODULATION_DEPTH 0.0f 123 | #define AL_EAXREVERB_MAX_MODULATION_DEPTH 1.0f 124 | #define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH 0.0f 125 | 126 | #define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF 0.892f 127 | #define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF 1.0f 128 | #define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF 0.994f 129 | 130 | #define AL_EAXREVERB_MIN_HFREFERENCE 1000.0f 131 | #define AL_EAXREVERB_MAX_HFREFERENCE 20000.0f 132 | #define AL_EAXREVERB_DEFAULT_HFREFERENCE 5000.0f 133 | 134 | #define AL_EAXREVERB_MIN_LFREFERENCE 20.0f 135 | #define AL_EAXREVERB_MAX_LFREFERENCE 1000.0f 136 | #define AL_EAXREVERB_DEFAULT_LFREFERENCE 250.0f 137 | 138 | #define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR 0.0f 139 | #define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR 10.0f 140 | #define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR 0.0f 141 | 142 | #define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE 143 | #define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE 144 | #define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE 145 | 146 | 147 | #ifdef __cplusplus 148 | } /* extern "C" */ 149 | #endif 150 | 151 | #endif /* __efxcreative_h_ */ 152 | -------------------------------------------------------------------------------- /OpenAL/include/xram.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // X-RAM Function pointer definitions 4 | typedef ALboolean (__cdecl *EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value); 5 | typedef ALenum (__cdecl *EAXGetBufferMode)(ALuint buffer, ALint *value); 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | // Query for X-RAM extension 9 | // 10 | // if (alIsExtensionPresent("EAX-RAM") == AL_TRUE) 11 | // X-RAM Extension found 12 | // 13 | ////////////////////////////////////////////////////////////////////////////// 14 | 15 | 16 | ////////////////////////////////////////////////////////////////////////////// 17 | // X-RAM enum names 18 | // 19 | // "AL_EAX_RAM_SIZE" 20 | // "AL_EAX_RAM_FREE" 21 | // "AL_STORAGE_AUTOMATIC" 22 | // "AL_STORAGE_HARDWARE" 23 | // "AL_STORAGE_ACCESSIBLE" 24 | // 25 | // Query enum values using alGetEnumValue, for example 26 | // 27 | // long lRamSizeEnum = alGetEnumValue("AL_EAX_RAM_SIZE") 28 | // 29 | ////////////////////////////////////////////////////////////////////////////// 30 | 31 | 32 | ////////////////////////////////////////////////////////////////////////////// 33 | // Query total amount of X-RAM 34 | // 35 | // long lTotalSize = alGetInteger(alGetEnumValue("AL_EAX_RAM_SIZE") 36 | // 37 | ////////////////////////////////////////////////////////////////////////////// 38 | 39 | 40 | ////////////////////////////////////////////////////////////////////////////// 41 | // Query free X-RAM available 42 | // 43 | // long lFreeSize = alGetInteger(alGetEnumValue("AL_EAX_RAM_FREE") 44 | // 45 | ////////////////////////////////////////////////////////////////////////////// 46 | 47 | 48 | ////////////////////////////////////////////////////////////////////////////// 49 | // Query X-RAM Function pointers 50 | // 51 | // Use typedefs defined above to get the X-RAM function pointers using 52 | // alGetProcAddress 53 | // 54 | // EAXSetBufferMode eaxSetBufferMode; 55 | // EAXGetBufferMode eaxGetBufferMode; 56 | // 57 | // eaxSetBufferMode = (EAXSetBufferMode)alGetProcAddress("EAXSetBufferMode"); 58 | // eaxGetBufferMode = (EAXGetBufferMode)alGetProcAddress("EAXGetBufferMode"); 59 | // 60 | ////////////////////////////////////////////////////////////////////////////// 61 | 62 | 63 | ////////////////////////////////////////////////////////////////////////////// 64 | // Force an Open AL Buffer into X-RAM (good for non-streaming buffers) 65 | // 66 | // ALuint uiBuffer; 67 | // alGenBuffers(1, &uiBuffer); 68 | // eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_HARDWARE")); 69 | // alBufferData(...); 70 | // 71 | ////////////////////////////////////////////////////////////////////////////// 72 | 73 | 74 | ////////////////////////////////////////////////////////////////////////////// 75 | // Force an Open AL Buffer into 'accessible' (currently host) RAM (good for streaming buffers) 76 | // 77 | // ALuint uiBuffer; 78 | // alGenBuffers(1, &uiBuffer); 79 | // eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_ACCESSIBLE")); 80 | // alBufferData(...); 81 | // 82 | ////////////////////////////////////////////////////////////////////////////// 83 | 84 | 85 | ////////////////////////////////////////////////////////////////////////////// 86 | // Put an Open AL Buffer into X-RAM if memory is available, otherwise use 87 | // host RAM. This is the default mode. 88 | // 89 | // ALuint uiBuffer; 90 | // alGenBuffers(1, &uiBuffer); 91 | // eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_AUTOMATIC")); 92 | // alBufferData(...); 93 | // 94 | ////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /OpenAL/libs/Win32/EFX-Util_MT/EFX-Util.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win32/EFX-Util_MT/EFX-Util.lib -------------------------------------------------------------------------------- /OpenAL/libs/Win32/EFX-Util_MTDLL/EFX-Util.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win32/EFX-Util_MTDLL/EFX-Util.lib -------------------------------------------------------------------------------- /OpenAL/libs/Win32/OpenAL32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win32/OpenAL32.lib -------------------------------------------------------------------------------- /OpenAL/libs/Win64/EFX-Util_MT/EFX-Util.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win64/EFX-Util_MT/EFX-Util.lib -------------------------------------------------------------------------------- /OpenAL/libs/Win64/EFX-Util_MTDLL/EFX-Util.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win64/EFX-Util_MTDLL/EFX-Util.lib -------------------------------------------------------------------------------- /OpenAL/libs/Win64/OpenAL32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/OpenAL/libs/Win64/OpenAL32.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # X-TCAS 2 | 3 | This is a generic implementation of TCAS II v7.1 designed for use in 4 | flight simulators. This is not a generic plugin intended for end users. 5 | Instead, it is designed to be used by aircraft model designers to be 6 | integrated into their simulated avionics package. 7 | 8 | ## Donations 9 | 10 | To leave a voluntary donation, please follow the PayPal link below: 11 | 12 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8DN9LYD5VP4NY) 13 | 14 | ## Building X-TCAS 15 | 16 | X-TCAS currently supports two build types: 17 | 18 | 1. As a stand-alone text-only mode for testing. This can be invoked by 19 | setting the following CMake variable: `cmake -DBUILD_STANDALONE_TEST=1 .`. 20 | 1. As a plugin for the X-Plane 10 and X-Plane 11 simulators. To invoke a 21 | build of this type, run: `cmake -DBUILD_STANDALONE_TEST=0 .`. 22 | 23 | A standalone test build runs from the command line and outputs an 24 | ASCII-art display of the horizontal situation surrounding the aircraft. 25 | It also requires a scenario "command" file, which defines which aircraft 26 | are involved in an encounter and what maneuvers they will perform. See 27 | `src/xtcas_test.c` for details. 28 | 29 | The embeddable version for X-Plane currently supports either displaying 30 | a test overlay in the simulator on the screen, or integrating into the 31 | FlightFactor 320 Ultimate aircraft. Contact the author to add support for 32 | more aircraft, as doing so requires special integration code to work with 33 | the aircraft's electronic flight information system (EFIS) displays. 34 | 35 | ## Disclaimer 36 | 37 | This project is intended strictly for *HOME ENTERTAINMENT* use only! Do 38 | **NOT** use X-TCAS for any serious flight training or real avionics. It 39 | has not passed any certification tests and might be wildly inaccurate. 40 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCBroadcaster.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCBroadcaster.h" 2 | #include "XPCListener.h" 3 | 4 | XPCBroadcaster::XPCBroadcaster() : 5 | mIterator(NULL) 6 | { 7 | } 8 | 9 | XPCBroadcaster::~XPCBroadcaster() 10 | { 11 | ListenerVector::iterator iter; 12 | mIterator = &iter; 13 | for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) 14 | { 15 | (*iter)->BroadcasterRemoved(this); 16 | } 17 | } 18 | 19 | void XPCBroadcaster::AddListener( 20 | XPCListener * inListener) 21 | { 22 | mListeners.push_back(inListener); 23 | inListener->BroadcasterAdded(this); 24 | } 25 | 26 | void XPCBroadcaster::RemoveListener( 27 | XPCListener * inListener) 28 | { 29 | ListenerVector::iterator iter = std::find 30 | (mListeners.begin(), mListeners.end(), inListener); 31 | if (iter == mListeners.end()) 32 | return; 33 | 34 | if (mIterator != NULL) 35 | { 36 | if (*mIterator >= iter) 37 | (*mIterator)--; 38 | } 39 | 40 | mListeners.erase(iter); 41 | inListener->BroadcasterRemoved(this); 42 | } 43 | 44 | void XPCBroadcaster::BroadcastMessage( 45 | int inMessage, 46 | void * inParam) 47 | { 48 | ListenerVector::iterator iter; 49 | mIterator = &iter; 50 | for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) 51 | { 52 | (*iter)->ListenToMessage(inMessage, inParam); 53 | } 54 | mIterator = NULL; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCBroadcaster.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCBroadcaster_h_ 2 | #define _XPCBroadcaster_h_ 3 | 4 | #include 5 | #include 6 | 7 | class XPCListener; 8 | 9 | class XPCBroadcaster { 10 | public: 11 | 12 | XPCBroadcaster(); 13 | virtual ~XPCBroadcaster(); 14 | 15 | void AddListener( 16 | XPCListener * inListener); 17 | void RemoveListener( 18 | XPCListener * inListener); 19 | 20 | protected: 21 | 22 | void BroadcastMessage( 23 | int inMessage, 24 | void * inParam=0); 25 | 26 | private: 27 | 28 | typedef std::vector ListenerVector; 29 | 30 | ListenerVector mListeners; 31 | 32 | // Reentrancy support 33 | 34 | ListenerVector::iterator * mIterator; 35 | 36 | }; 37 | 38 | #endif -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCDisplay.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCDisplay.h" 2 | 3 | XPCKeySniffer::XPCKeySniffer(int inBeforeWindows) : mBeforeWindows(inBeforeWindows) 4 | { 5 | XPLMRegisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast(this)); 6 | } 7 | 8 | XPCKeySniffer::~XPCKeySniffer() 9 | { 10 | XPLMUnregisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast(this)); 11 | } 12 | 13 | 14 | int XPCKeySniffer::KeySnifferCB( 15 | char inCharKey, 16 | XPLMKeyFlags inFlags, 17 | char inVirtualKey, 18 | void * inRefCon) 19 | { 20 | XPCKeySniffer * me = reinterpret_cast(inRefCon); 21 | return me->HandleKeyStroke(inCharKey, inFlags, inVirtualKey); 22 | } 23 | 24 | XPCWindow::XPCWindow( 25 | int inLeft, 26 | int inTop, 27 | int inRight, 28 | int inBottom, 29 | int inIsVisible) 30 | { 31 | mWindow = XPLMCreateWindow(inLeft, inTop, inRight, inBottom, inIsVisible, 32 | DrawCB, HandleKeyCB, MouseClickCB, 33 | reinterpret_cast(this)); 34 | } 35 | 36 | XPCWindow::~XPCWindow() 37 | { 38 | XPLMDestroyWindow(mWindow); 39 | } 40 | 41 | void XPCWindow::GetWindowGeometry( 42 | int * outLeft, 43 | int * outTop, 44 | int * outRight, 45 | int * outBottom) 46 | { 47 | XPLMGetWindowGeometry(mWindow, outLeft, outTop, outRight, outBottom); 48 | } 49 | 50 | void XPCWindow::SetWindowGeometry( 51 | int inLeft, 52 | int inTop, 53 | int inRight, 54 | int inBottom) 55 | { 56 | XPLMSetWindowGeometry(mWindow, inLeft, inTop, inRight, inBottom); 57 | } 58 | 59 | int XPCWindow::GetWindowIsVisible(void) 60 | { 61 | return XPLMGetWindowIsVisible(mWindow); 62 | } 63 | 64 | void XPCWindow::SetWindowIsVisible( 65 | int inIsVisible) 66 | { 67 | XPLMSetWindowIsVisible(mWindow, inIsVisible); 68 | } 69 | 70 | void XPCWindow::TakeKeyboardFocus(void) 71 | { 72 | XPLMTakeKeyboardFocus(mWindow); 73 | } 74 | 75 | void XPCWindow::BringWindowToFront(void) 76 | { 77 | XPLMBringWindowToFront(mWindow); 78 | } 79 | 80 | int XPCWindow::IsWindowInFront(void) 81 | { 82 | return XPLMIsWindowInFront(mWindow); 83 | } 84 | 85 | void XPCWindow::DrawCB(XPLMWindowID inWindowID, void * inRefcon) 86 | { 87 | XPCWindow * me = reinterpret_cast(inRefcon); 88 | me->DoDraw(); 89 | } 90 | 91 | void XPCWindow::HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus) 92 | { 93 | XPCWindow * me = reinterpret_cast(inRefcon); 94 | if (losingFocus) 95 | me->LoseFocus(); 96 | else 97 | me->HandleKey(inKey, inFlags, inVirtualKey); 98 | } 99 | 100 | int XPCWindow::MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon) 101 | { 102 | XPCWindow * me = reinterpret_cast(inRefcon); 103 | return me->HandleClick(x, y, inMouse); 104 | } 105 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCDisplay.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCDisplay_h_ 2 | #define _XPCDisplay_h_ 3 | 4 | #include "XPLMDisplay.h" 5 | 6 | class XPCKeySniffer { 7 | public: 8 | 9 | XPCKeySniffer(int inBeforeWindows); 10 | virtual ~XPCKeySniffer(); 11 | 12 | virtual int HandleKeyStroke( 13 | char inCharKey, 14 | XPLMKeyFlags inFlags, 15 | char inVirtualKey)=0; 16 | 17 | private: 18 | 19 | int mBeforeWindows; 20 | 21 | static int KeySnifferCB( 22 | char inCharKey, 23 | XPLMKeyFlags inFlags, 24 | char inVirtualKey, 25 | void * inRefCon); 26 | }; 27 | 28 | 29 | 30 | class XPCWindow { 31 | public: 32 | 33 | XPCWindow( 34 | int inLeft, 35 | int inTop, 36 | int inRight, 37 | int inBottom, 38 | int inIsVisible); 39 | virtual ~XPCWindow(); 40 | 41 | virtual void DoDraw(void)=0; 42 | virtual void HandleKey(char inKey, XPLMKeyFlags inFlags, char inVirtualKey)=0; 43 | virtual void LoseFocus(void)=0; 44 | virtual int HandleClick(int x, int y, XPLMMouseStatus inMouse)=0; 45 | 46 | void GetWindowGeometry( 47 | int * outLeft, 48 | int * outTop, 49 | int * outRight, 50 | int * outBottom); 51 | void SetWindowGeometry( 52 | int inLeft, 53 | int inTop, 54 | int inRight, 55 | int inBottom); 56 | int GetWindowIsVisible(void); 57 | void SetWindowIsVisible( 58 | int inIsVisible); 59 | void TakeKeyboardFocus(void); 60 | void BringWindowToFront(void); 61 | int IsWindowInFront(void); 62 | 63 | private: 64 | 65 | XPLMWindowID mWindow; 66 | 67 | static void DrawCB(XPLMWindowID inWindowID, void * inRefcon); 68 | static void HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus); 69 | static int MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon); 70 | 71 | }; 72 | 73 | #endif -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCListener.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCListener.h" 2 | #include "XPCBroadcaster.h" 3 | 4 | XPCListener::XPCListener() 5 | { 6 | } 7 | 8 | XPCListener::~XPCListener() 9 | { 10 | while (!mBroadcasters.empty()) 11 | mBroadcasters.front()->RemoveListener(this); 12 | } 13 | 14 | void XPCListener::BroadcasterAdded( 15 | XPCBroadcaster * inBroadcaster) 16 | { 17 | mBroadcasters.push_back(inBroadcaster); 18 | } 19 | 20 | void XPCListener::BroadcasterRemoved( 21 | XPCBroadcaster * inBroadcaster) 22 | { 23 | BroadcastVector::iterator iter = std::find(mBroadcasters.begin(), 24 | mBroadcasters.end(), inBroadcaster); 25 | if (iter != mBroadcasters.end()) 26 | mBroadcasters.erase(iter); 27 | } 28 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCListener.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCListener_h_ 2 | #define _XPCListener_h_ 3 | 4 | #include 5 | #include 6 | 7 | class XPCBroadcaster; 8 | 9 | 10 | class XPCListener { 11 | public: 12 | 13 | XPCListener(); 14 | virtual ~XPCListener(); 15 | 16 | virtual void ListenToMessage( 17 | int inMessage, 18 | void * inParam)=0; 19 | 20 | private: 21 | 22 | typedef std::vector BroadcastVector; 23 | 24 | BroadcastVector mBroadcasters; 25 | 26 | friend class XPCBroadcaster; 27 | 28 | void BroadcasterAdded( 29 | XPCBroadcaster * inBroadcaster); 30 | 31 | void BroadcasterRemoved( 32 | XPCBroadcaster * inBroadcaster); 33 | 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCProcessing.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCProcessing.h" 2 | #include "XPLMUtilities.h" 3 | 4 | XPCProcess::XPCProcess() : 5 | mInCallback(false), 6 | mCallbackTime(0) 7 | { 8 | XPLMRegisterFlightLoopCallback(FlightLoopCB, 0, reinterpret_cast(this)); 9 | } 10 | 11 | XPCProcess::~XPCProcess() 12 | { 13 | XPLMUnregisterFlightLoopCallback(FlightLoopCB, reinterpret_cast(this)); 14 | } 15 | 16 | void XPCProcess::StartProcessTime(float inSeconds) 17 | { 18 | mCallbackTime = inSeconds; 19 | if (!mInCallback) 20 | XPLMSetFlightLoopCallbackInterval( 21 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 22 | } 23 | 24 | void XPCProcess::StartProcessCycles(int inCycles) 25 | { 26 | mCallbackTime = -inCycles; 27 | if (!mInCallback) 28 | XPLMSetFlightLoopCallbackInterval( 29 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 30 | } 31 | 32 | void XPCProcess::StopProcess(void) 33 | { 34 | mCallbackTime = 0; 35 | if (!mInCallback) 36 | XPLMSetFlightLoopCallbackInterval( 37 | FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast(this)); 38 | } 39 | 40 | 41 | float XPCProcess::FlightLoopCB( 42 | float inElapsedSinceLastCall, 43 | float inElapsedTimeSinceLastFlightLoop, 44 | int inCounter, 45 | void * inRefcon) 46 | { 47 | XPCProcess * me = reinterpret_cast(inRefcon); 48 | me->mInCallback = true; 49 | me->DoProcessing(inElapsedSinceLastCall, inElapsedTimeSinceLastFlightLoop, inCounter); 50 | me->mInCallback = false; 51 | return me->mCallbackTime; 52 | } -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCProcessing.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCProcessing_h_ 2 | #define _XPCProcessing_h_ 3 | 4 | #include "XPLMProcessing.h" 5 | 6 | class XPCProcess { 7 | public: 8 | 9 | XPCProcess(); 10 | virtual ~XPCProcess(); 11 | 12 | void StartProcessTime(float inSeconds); 13 | void StartProcessCycles(int inCycles); 14 | void StopProcess(void); 15 | 16 | virtual void DoProcessing( 17 | float inElapsedSinceLastCall, 18 | float inElapsedTimeSinceLastFlightLoop, 19 | int inCounter)=0; 20 | 21 | private: 22 | 23 | static float FlightLoopCB( 24 | float inElapsedSinceLastCall, 25 | float inElapsedTimeSinceLastFlightLoop, 26 | int inCounter, 27 | void * inRefcon); 28 | 29 | bool mInCallback; 30 | float mCallbackTime; 31 | 32 | XPCProcess(const XPCProcess&); 33 | XPCProcess& operator=(const XPCProcess&); 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCWidget.h" 2 | 3 | XPCWidget::XPCWidget( 4 | int inLeft, 5 | int inTop, 6 | int inRight, 7 | int inBottom, 8 | bool inVisible, 9 | const char * inDescriptor, 10 | bool inIsRoot, 11 | XPWidgetID inParent, 12 | XPWidgetClass inClass) : 13 | mWidget(NULL), 14 | mOwnsChildren(false), 15 | mOwnsWidget(true) 16 | { 17 | mWidget = XPCreateWidget( 18 | inLeft, inTop, inRight, inBottom, 19 | inVisible ? 1 : 0, 20 | inDescriptor, 21 | inIsRoot ? 1 : 0, 22 | inIsRoot ? NULL : inParent, 23 | inClass); 24 | 25 | XPSetWidgetProperty(mWidget, xpProperty_Object, reinterpret_cast(this)); 26 | XPAddWidgetCallback(mWidget, WidgetCallback); 27 | } 28 | 29 | XPCWidget::XPCWidget( 30 | XPWidgetID inWidget, 31 | bool inOwnsWidget) : 32 | mWidget(inWidget), 33 | mOwnsChildren(false), 34 | mOwnsWidget(inOwnsWidget) 35 | { 36 | XPSetWidgetProperty(mWidget, xpProperty_Object, reinterpret_cast(this)); 37 | XPAddWidgetCallback(mWidget, WidgetCallback); 38 | } 39 | 40 | XPCWidget::~XPCWidget() 41 | { 42 | if (mOwnsWidget) 43 | XPDestroyWidget(mWidget, mOwnsChildren ? 1 : 0); 44 | } 45 | 46 | void XPCWidget::SetOwnsWidget( 47 | bool inOwnsWidget) 48 | { 49 | mOwnsWidget = inOwnsWidget; 50 | } 51 | 52 | void XPCWidget::SetOwnsChildren( 53 | bool inOwnsChildren) 54 | { 55 | mOwnsChildren = inOwnsChildren; 56 | } 57 | 58 | XPCWidget::operator XPWidgetID () const 59 | { 60 | return mWidget; 61 | } 62 | 63 | XPWidgetID XPCWidget::Get(void) const 64 | { 65 | return mWidget; 66 | } 67 | 68 | void XPCWidget::AddAttachment( 69 | XPCWidgetAttachment * inAttachment, 70 | bool inOwnsAttachment, 71 | bool inPrefilter) 72 | { 73 | if (inPrefilter) 74 | { 75 | mAttachments.insert(mAttachments.begin(), AttachmentInfo(inAttachment, inOwnsAttachment)); 76 | } else { 77 | mAttachments.push_back(AttachmentInfo(inAttachment, inOwnsAttachment)); 78 | } 79 | } 80 | 81 | void XPCWidget::RemoveAttachment( 82 | XPCWidgetAttachment * inAttachment) 83 | { 84 | for (AttachmentVector::iterator iter = mAttachments.begin(); 85 | iter != mAttachments.end(); ++iter) 86 | { 87 | if (iter->first == inAttachment) 88 | { 89 | mAttachments.erase(iter); 90 | return; 91 | } 92 | } 93 | } 94 | 95 | int XPCWidget::HandleWidgetMessage( 96 | XPWidgetMessage inMessage, 97 | XPWidgetID inWidget, 98 | intptr_t inParam1, 99 | intptr_t inParam2) 100 | { 101 | return 0; 102 | } 103 | 104 | int XPCWidget::WidgetCallback( 105 | XPWidgetMessage inMessage, 106 | XPWidgetID inWidget, 107 | intptr_t inParam1, 108 | intptr_t inParam2) 109 | { 110 | XPCWidget * me = reinterpret_cast(XPGetWidgetProperty(inWidget, xpProperty_Object, NULL)); 111 | if (me == NULL) 112 | return 0; 113 | 114 | for (AttachmentVector::iterator iter = me->mAttachments.begin(); iter != 115 | me->mAttachments.end(); ++iter) 116 | { 117 | int result = iter->first->HandleWidgetMessage(me, inMessage, inWidget, inParam1, inParam2); 118 | if (result != 0) 119 | return result; 120 | } 121 | 122 | return me->HandleWidgetMessage(inMessage, inWidget, inParam1, inParam2); 123 | } 124 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCWidget_h_ 2 | #define _XPCWidget_h_ 3 | 4 | #include 5 | #include 6 | #include "XPWidgets.h" 7 | 8 | class XPCWidget; 9 | 10 | class XPCWidgetAttachment { 11 | public: 12 | 13 | virtual int HandleWidgetMessage( 14 | XPCWidget * inObject, 15 | XPWidgetMessage inMessage, 16 | XPWidgetID inWidget, 17 | intptr_t inParam1, 18 | intptr_t inParam2)=0; 19 | 20 | }; 21 | 22 | class XPCWidget { 23 | public: 24 | 25 | XPCWidget( 26 | int inLeft, 27 | int inTop, 28 | int inRight, 29 | int inBottom, 30 | bool inVisible, 31 | const char * inDescriptor, 32 | bool inIsRoot, 33 | XPWidgetID inParent, 34 | XPWidgetClass inClass); 35 | XPCWidget( 36 | XPWidgetID inWidget, 37 | bool inOwnsWidget); 38 | virtual ~XPCWidget(); 39 | 40 | void SetOwnsWidget( 41 | bool inOwnsWidget); 42 | void SetOwnsChildren( 43 | bool inOwnsChildren); 44 | 45 | operator XPWidgetID () const; 46 | 47 | XPWidgetID Get(void) const; 48 | 49 | void AddAttachment( 50 | XPCWidgetAttachment * inAttachment, 51 | bool inOwnsAttachment, 52 | bool inPrefilter); 53 | void RemoveAttachment( 54 | XPCWidgetAttachment * inAttachment); 55 | 56 | virtual int HandleWidgetMessage( 57 | XPWidgetMessage inMessage, 58 | XPWidgetID inWidget, 59 | intptr_t inParam1, 60 | intptr_t inParam2); 61 | 62 | private: 63 | 64 | static int WidgetCallback( 65 | XPWidgetMessage inMessage, 66 | XPWidgetID inWidget, 67 | intptr_t inParam1, 68 | intptr_t inParam2); 69 | 70 | typedef std::pair AttachmentInfo; 71 | typedef std::vector AttachmentVector; 72 | 73 | AttachmentVector mAttachments; 74 | XPWidgetID mWidget; 75 | bool mOwnsChildren; 76 | bool mOwnsWidget; 77 | 78 | XPCWidget(); 79 | XPCWidget(const XPCWidget&); 80 | XPCWidget& operator=(const XPCWidget&); 81 | 82 | }; 83 | 84 | #endif -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCWidgetAttachments.cpp: -------------------------------------------------------------------------------- 1 | #include "XPCWidgetAttachments.h" 2 | #include "XPStandardWidgets.h" 3 | #include "XPWidgetUtils.h" 4 | 5 | static void XPCGetOrderedSubWidgets( 6 | XPWidgetID inWidget, 7 | std::vector& outChildren); 8 | 9 | XPCKeyFilterAttachment::XPCKeyFilterAttachment( 10 | const char * inValidKeys, 11 | const char * outValidKeys) : 12 | mInput(inValidKeys), 13 | mOutput(outValidKeys) 14 | { 15 | } 16 | 17 | XPCKeyFilterAttachment::~XPCKeyFilterAttachment() 18 | { 19 | } 20 | 21 | int XPCKeyFilterAttachment::HandleWidgetMessage( 22 | XPCWidget * inObject, 23 | XPWidgetMessage inMessage, 24 | XPWidgetID inWidget, 25 | intptr_t inParam1, 26 | intptr_t inParam2) 27 | { 28 | if (inMessage == xpMsg_KeyPress) 29 | { 30 | char& theKey = KEY_CHAR(inParam1); 31 | std::string::size_type pos = mInput.find(theKey); 32 | if (pos == std::string::npos) 33 | return 1; // Not found; eat the key! 34 | else { 35 | theKey = mOutput[pos]; 36 | return 0; 37 | } // Let it live. 38 | } 39 | return 0; 40 | } 41 | 42 | 43 | XPCKeyMessageAttachment::XPCKeyMessageAttachment( 44 | char inKey, 45 | int inMessage, 46 | void * inParam, 47 | bool inConsume, 48 | bool inVkey, 49 | XPCListener * inListener) : 50 | mKey(inKey), mMsg(inMessage), mParam(inParam), mConsume(inConsume), 51 | mVkey(inVkey) 52 | { 53 | if (inListener != NULL) 54 | this->AddListener(inListener); 55 | } 56 | 57 | XPCKeyMessageAttachment::~XPCKeyMessageAttachment() 58 | { 59 | } 60 | 61 | int XPCKeyMessageAttachment::HandleWidgetMessage( 62 | XPCWidget * inObject, 63 | XPWidgetMessage inMessage, 64 | XPWidgetID inWidget, 65 | intptr_t inParam1, 66 | intptr_t inParam2) 67 | { 68 | if (inMessage == xpMsg_KeyPress) 69 | { 70 | char theKey = mVkey ? KEY_VKEY(inParam1) : KEY_CHAR(inParam1); 71 | if (theKey != mKey) 72 | return 0; 73 | if (!(KEY_FLAGS(inParam1) & xplm_DownFlag)) 74 | return 0; 75 | 76 | BroadcastMessage(mMsg, mParam); 77 | return mConsume ? 1 : 0; 78 | } 79 | return 0; 80 | } 81 | 82 | XPCPushButtonMessageAttachment::XPCPushButtonMessageAttachment( 83 | XPWidgetID inWidget, 84 | int inMessage, 85 | void * inParam, 86 | XPCListener * inListener) : 87 | mMsg(inMessage), mParam(inParam), mWidget(inWidget) 88 | { 89 | if (inListener != NULL) 90 | this->AddListener(inListener); 91 | } 92 | 93 | XPCPushButtonMessageAttachment::~XPCPushButtonMessageAttachment() 94 | { 95 | } 96 | 97 | int XPCPushButtonMessageAttachment::HandleWidgetMessage( 98 | XPCWidget * inObject, 99 | XPWidgetMessage inMessage, 100 | XPWidgetID inWidget, 101 | intptr_t inParam1, 102 | intptr_t inParam2) 103 | { 104 | if ((inMessage == xpMsg_PushButtonPressed) && ((XPWidgetID) inParam1 == mWidget)) 105 | { 106 | BroadcastMessage(mMsg, mParam); 107 | return 1; 108 | } 109 | 110 | if ((inMessage == xpMsg_ButtonStateChanged) && ((XPWidgetID) inParam1 == mWidget)) 111 | { 112 | BroadcastMessage(mMsg, mParam); 113 | return 1; 114 | } 115 | return 0; 116 | } 117 | 118 | XPCSliderMessageAttachment::XPCSliderMessageAttachment( 119 | XPWidgetID inWidget, 120 | int inMessage, 121 | void * inParam, 122 | XPCListener * inListener) : 123 | mMsg(inMessage), mParam(inParam), mWidget(inWidget) 124 | { 125 | if (inListener != NULL) 126 | this->AddListener(inListener); 127 | } 128 | 129 | XPCSliderMessageAttachment::~XPCSliderMessageAttachment() 130 | { 131 | } 132 | 133 | int XPCSliderMessageAttachment::HandleWidgetMessage( 134 | XPCWidget * inObject, 135 | XPWidgetMessage inMessage, 136 | XPWidgetID inWidget, 137 | intptr_t inParam1, 138 | intptr_t inParam2) 139 | { 140 | if ((inMessage == xpMsg_ScrollBarSliderPositionChanged) && ((XPWidgetID) inParam1 == mWidget)) 141 | { 142 | BroadcastMessage(mMsg, mParam); 143 | return 1; 144 | } 145 | 146 | return 0; 147 | } 148 | 149 | 150 | XPCCloseButtonMessageAttachment::XPCCloseButtonMessageAttachment( 151 | XPWidgetID inWidget, 152 | int inMessage, 153 | void * inParam, 154 | XPCListener * inListener) : 155 | mMsg(inMessage), mParam(inParam), mWidget(inWidget) 156 | { 157 | if (inListener != NULL) 158 | this->AddListener(inListener); 159 | } 160 | 161 | XPCCloseButtonMessageAttachment::~XPCCloseButtonMessageAttachment() 162 | { 163 | } 164 | 165 | int XPCCloseButtonMessageAttachment::HandleWidgetMessage( 166 | XPCWidget * inObject, 167 | XPWidgetMessage inMessage, 168 | XPWidgetID inWidget, 169 | intptr_t inParam1, 170 | intptr_t inParam2) 171 | { 172 | if ((inMessage == xpMessage_CloseButtonPushed) && ((XPWidgetID) inParam1 == mWidget)) 173 | { 174 | BroadcastMessage(mMsg, mParam); 175 | return 1; 176 | } 177 | 178 | return 0; 179 | } 180 | 181 | XPCTabGroupAttachment::XPCTabGroupAttachment() 182 | { 183 | } 184 | 185 | XPCTabGroupAttachment::~XPCTabGroupAttachment() 186 | { 187 | } 188 | 189 | int XPCTabGroupAttachment::HandleWidgetMessage( 190 | XPCWidget * inObject, 191 | XPWidgetMessage inMessage, 192 | XPWidgetID inWidget, 193 | intptr_t inParam1, 194 | intptr_t inParam2) 195 | { 196 | if ((inMessage == xpMsg_KeyPress) && (KEY_CHAR(inParam1) == XPLM_KEY_TAB) && 197 | ((KEY_FLAGS(inParam1) & xplm_UpFlag) == 0)) 198 | { 199 | bool backwards = (KEY_FLAGS(inParam1) & xplm_ShiftFlag) != 0; 200 | std::vector widgets; 201 | XPCGetOrderedSubWidgets(inWidget, widgets); 202 | int n, index = 0; 203 | XPWidgetID focusWidget = XPGetWidgetWithFocus(); 204 | std::vector::iterator iter = std::find(widgets.begin(), widgets.end(), focusWidget); 205 | if (iter != widgets.end()) 206 | { 207 | index = std::distance(widgets.begin(), iter); 208 | if (backwards) 209 | index--; 210 | else 211 | index++; 212 | if (index < 0) 213 | index = widgets.size() - 1; 214 | if (index >= widgets.size()) 215 | index = 0; 216 | } 217 | 218 | if (backwards) 219 | { 220 | for (n = index; n >= 0; --n) 221 | { 222 | if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL)) 223 | if (XPSetKeyboardFocus(widgets[n]) != NULL) 224 | return 1; 225 | } 226 | for (n = widgets.size() - 1; n > index; --n) 227 | { 228 | if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL)) 229 | if (XPSetKeyboardFocus(widgets[n]) != NULL) 230 | return 1; 231 | } 232 | } else { 233 | for (n = index; n < widgets.size(); ++n) 234 | { 235 | if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL)) 236 | if (XPSetKeyboardFocus(widgets[n]) != NULL) 237 | return 1; 238 | } 239 | for (n = 0; n < index; ++n) 240 | { 241 | if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL)) 242 | if (XPSetKeyboardFocus(widgets[n]) != NULL) 243 | return 1; 244 | } 245 | } 246 | } 247 | return 0; 248 | } 249 | 250 | 251 | 252 | static void XPCGetOrderedSubWidgets( 253 | XPWidgetID inWidget, 254 | std::vector& outChildren) 255 | { 256 | outChildren.clear(); 257 | int count = XPCountChildWidgets(inWidget); 258 | for (int n = 0; n < count; ++n) 259 | { 260 | XPWidgetID child = XPGetNthChildWidget(inWidget, n); 261 | outChildren.push_back(child); 262 | std::vector grandChildren; 263 | XPCGetOrderedSubWidgets(child, grandChildren); 264 | 265 | outChildren.insert(outChildren.end(), grandChildren.begin(), grandChildren.end()); 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /SDK/CHeaders/Wrappers/XPCWidgetAttachments.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPCWidgetAttachments_h_ 2 | #define _XPCWidgetAttachments_h_ 3 | 4 | #include 5 | 6 | #include "XPCWidget.h" 7 | #include "XPCBroadcaster.h" 8 | 9 | class XPCKeyFilterAttachment : public XPCWidgetAttachment { 10 | public: 11 | 12 | XPCKeyFilterAttachment( 13 | const char * inValidKeys, 14 | const char * outValidKeys); 15 | virtual ~XPCKeyFilterAttachment(); 16 | 17 | virtual int HandleWidgetMessage( 18 | XPCWidget * inObject, 19 | XPWidgetMessage inMessage, 20 | XPWidgetID inWidget, 21 | intptr_t inParam1, 22 | intptr_t inParam2); 23 | 24 | private: 25 | 26 | std::string mInput; 27 | std::string mOutput; 28 | 29 | }; 30 | 31 | 32 | class XPCKeyMessageAttachment : public XPCWidgetAttachment, public XPCBroadcaster { 33 | public: 34 | 35 | XPCKeyMessageAttachment( 36 | char inKey, 37 | int inMessage, 38 | void * inParam, 39 | bool inConsume, 40 | bool inVkey, 41 | XPCListener * inListener); 42 | virtual ~XPCKeyMessageAttachment(); 43 | 44 | virtual int HandleWidgetMessage( 45 | XPCWidget * inObject, 46 | XPWidgetMessage inMessage, 47 | XPWidgetID inWidget, 48 | intptr_t inParam1, 49 | intptr_t inParam2); 50 | 51 | private: 52 | 53 | char mKey; 54 | bool mVkey; 55 | int mMsg; 56 | void * mParam; 57 | bool mConsume; 58 | 59 | }; 60 | 61 | class XPCPushButtonMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster { 62 | public: 63 | 64 | XPCPushButtonMessageAttachment( 65 | XPWidgetID inWidget, 66 | int inMessage, 67 | void * inParam, 68 | XPCListener * inListener); 69 | virtual ~XPCPushButtonMessageAttachment(); 70 | 71 | virtual int HandleWidgetMessage( 72 | XPCWidget * inObject, 73 | XPWidgetMessage inMessage, 74 | XPWidgetID inWidget, 75 | intptr_t inParam1, 76 | intptr_t inParam2); 77 | 78 | private: 79 | XPWidgetID mWidget; 80 | int mMsg; 81 | void * mParam; 82 | }; 83 | 84 | class XPCSliderMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster { 85 | public: 86 | 87 | XPCSliderMessageAttachment( 88 | XPWidgetID inWidget, 89 | int inMessage, 90 | void * inParam, 91 | XPCListener * inListener); 92 | virtual ~XPCSliderMessageAttachment(); 93 | 94 | virtual int HandleWidgetMessage( 95 | XPCWidget * inObject, 96 | XPWidgetMessage inMessage, 97 | XPWidgetID inWidget, 98 | intptr_t inParam1, 99 | intptr_t inParam2); 100 | 101 | private: 102 | XPWidgetID mWidget; 103 | int mMsg; 104 | void * mParam; 105 | }; 106 | 107 | 108 | class XPCCloseButtonMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster { 109 | public: 110 | 111 | XPCCloseButtonMessageAttachment( 112 | XPWidgetID inWidget, 113 | int inMessage, 114 | void * inParam, 115 | XPCListener * inListener); 116 | virtual ~XPCCloseButtonMessageAttachment(); 117 | 118 | virtual int HandleWidgetMessage( 119 | XPCWidget * inObject, 120 | XPWidgetMessage inMessage, 121 | XPWidgetID inWidget, 122 | intptr_t inParam1, 123 | intptr_t inParam2); 124 | 125 | private: 126 | XPWidgetID mWidget; 127 | int mMsg; 128 | void * mParam; 129 | }; 130 | 131 | class XPCTabGroupAttachment : public XPCWidgetAttachment { 132 | public: 133 | 134 | XPCTabGroupAttachment(); 135 | virtual ~XPCTabGroupAttachment(); 136 | 137 | virtual int HandleWidgetMessage( 138 | XPCWidget * inObject, 139 | XPWidgetMessage inMessage, 140 | XPWidgetID inWidget, 141 | intptr_t inParam1, 142 | intptr_t inParam2); 143 | 144 | }; 145 | 146 | #endif -------------------------------------------------------------------------------- /SDK/CHeaders/XPLM/XPLMCamera.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPLMCamera_h_ 2 | #define _XPLMCamera_h_ 3 | 4 | /* 5 | * Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See 6 | * license.txt for usage. X-Plane SDK Version: 2.1.1 7 | * 8 | */ 9 | 10 | /*************************************************************************** 11 | * XPLMCamera 12 | ***************************************************************************/ 13 | /* 14 | * The XPLMCamera APIs allow plug-ins to control the camera angle in X-Plane. 15 | * This has a number of applications, including but not limited to: 16 | * 17 | * - Creating new views (including dynamic/user-controllable views) for the 18 | * user. 19 | * - Creating applications that use X-Plane as a renderer of scenery, 20 | * aircrafts, or both. 21 | * 22 | * The camera is controlled via six parameters: a location in OpenGL 23 | * coordinates and pitch, roll and yaw, similar to an airplane's position. 24 | * OpenGL coordinate info is described in detail in the XPLMGraphics 25 | * documentation; generally you should use the XPLMGraphics routines to 26 | * convert from world to local coordinates. The camera's orientation starts 27 | * facing level with the ground directly up the negative-Z axis (approximately 28 | * north) with the horizon horizontal. It is then rotated clockwise for yaw, 29 | * pitched up for positive pitch, and rolled clockwise around the vector it is 30 | * looking along for roll. 31 | * 32 | * You control the camera either either until the user selects a new view or 33 | * permanently (the later being similar to how UDP camera control works). You 34 | * control the camera by registering a callback per frame from which you 35 | * calculate the new camera positions. This guarantees smooth camera motion. 36 | * 37 | * Use the XPLMDataAccess APIs to get information like the position of the 38 | * aircraft, etc. for complex camera positioning. 39 | * 40 | * Note: if your goal is to move the virtual pilot in the cockpit, this API is 41 | * not needed; simply update the datarefs for the pilot's head position. 42 | * 43 | * For custom exterior cameras, set the camera's mode to an external view 44 | * first to get correct sound and 2-d panel behavior. 45 | * 46 | */ 47 | 48 | #include "XPLMDefs.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | /*************************************************************************** 55 | * CAMERA CONTROL 56 | ***************************************************************************/ 57 | 58 | /* 59 | * XPLMCameraControlDuration 60 | * 61 | * This enumeration states how long you want to retain control of the camera. 62 | * You can retain it indefinitely or until the user selects a new view. 63 | * 64 | */ 65 | enum { 66 | /* Control the camera until the user picks a new view. */ 67 | xplm_ControlCameraUntilViewChanges = 1, 68 | 69 | /* Control the camera until your plugin is disabled or another plugin forcably* 70 | * takes control. */ 71 | xplm_ControlCameraForever = 2, 72 | 73 | 74 | }; 75 | typedef int XPLMCameraControlDuration; 76 | 77 | /* 78 | * XPLMCameraPosition_t 79 | * 80 | * This structure contains a full specification of the camera. X, Y, and Z are 81 | * the camera's position in OpenGL coordiantes; pitch, roll, and yaw are 82 | * rotations from a camera facing flat north in degrees. Positive pitch means 83 | * nose up, positive roll means roll right, and positive yaw means yaw right, 84 | * all in degrees. Zoom is a zoom factor, with 1.0 meaning normal zoom and 2.0 85 | * magnifying by 2x (objects appear larger). 86 | * 87 | */ 88 | typedef struct { 89 | float x; 90 | float y; 91 | float z; 92 | float pitch; 93 | float heading; 94 | float roll; 95 | float zoom; 96 | } XPLMCameraPosition_t; 97 | 98 | /* 99 | * XPLMCameraControl_f 100 | * 101 | * You use an XPLMCameraControl function to provide continuous control over 102 | * the camera. You are passed in a structure in which to put the new camera 103 | * position; modify it and return 1 to reposition the camera. Return 0 to 104 | * surrender control of the camera; camera control will be handled by X-Plane 105 | * on this draw loop. The contents of the structure as you are called are 106 | * undefined. 107 | * 108 | * If X-Plane is taking camera control away from you, this function will be 109 | * called with inIsLosingControl set to 1 and ioCameraPosition NULL. 110 | * 111 | */ 112 | typedef int (* XPLMCameraControl_f)( 113 | XPLMCameraPosition_t * outCameraPosition, /* Can be NULL */ 114 | int inIsLosingControl, 115 | void * inRefcon); 116 | 117 | /* 118 | * XPLMControlCamera 119 | * 120 | * This function repositions the camera on the next drawing cycle. You must 121 | * pass a non-null control function. Specify in inHowLong how long you'd like 122 | * control (indefinitely or until a new view mode is set by the user). 123 | * 124 | */ 125 | XPLM_API void XPLMControlCamera( 126 | XPLMCameraControlDuration inHowLong, 127 | XPLMCameraControl_f inControlFunc, 128 | void * inRefcon); 129 | 130 | /* 131 | * XPLMDontControlCamera 132 | * 133 | * This function stops you from controlling the camera. If you have a camera 134 | * control function, it will not be called with an inIsLosingControl flag. 135 | * X-Plane will control the camera on the next cycle. 136 | * 137 | * For maximum compatibility you should not use this routine unless you are in 138 | * posession of the camera. 139 | * 140 | */ 141 | XPLM_API void XPLMDontControlCamera(void); 142 | 143 | /* 144 | * XPLMIsCameraBeingControlled 145 | * 146 | * This routine returns 1 if the camera is being controlled, zero if it is 147 | * not. If it is and you pass in a pointer to a camera control duration, the 148 | * current control duration will be returned. 149 | * 150 | */ 151 | XPLM_API int XPLMIsCameraBeingControlled( 152 | XPLMCameraControlDuration * outCameraControlDuration); /* Can be NULL */ 153 | 154 | /* 155 | * XPLMReadCameraPosition 156 | * 157 | * This function reads the current camera position. 158 | * 159 | */ 160 | XPLM_API void XPLMReadCameraPosition( 161 | XPLMCameraPosition_t * outCameraPosition); 162 | 163 | #ifdef __cplusplus 164 | } 165 | #endif 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /SDK/CHeaders/XPLM/XPLMInstance.h: -------------------------------------------------------------------------------- 1 | #ifndef _XPLMInstance_h_ 2 | #define _XPLMInstance_h_ 3 | 4 | /* 5 | * Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See 6 | * license.txt for usage. X-Plane SDK Version: 2.1.1 7 | * 8 | */ 9 | 10 | /*************************************************************************** 11 | * XPLMInstance 12 | ***************************************************************************/ 13 | /* 14 | * This API provides instanced drawing of X-Plane objects (.obj files). In 15 | * contrast to old drawing APIs, which required you to draw your own objects 16 | * per-frame, the instancing API allows you to simply register an OBJ for 17 | * drawing, then move or manipulate it later (as needed). 18 | * 19 | * This provides one tremendous benefit: it keeps all dataref operations for 20 | * your object in one place. Because datarefs are main thread only, allowing 21 | * dataref access anywhere is a serious performance bottleneck for the 22 | * simulator---the whole simulator has to pause and wait for each dataref 23 | * access. This performance penalty will only grow worse as X-Plane moves 24 | * toward an ever more heavily multithreaded engine. 25 | * 26 | * The instancing API allows X-Plane to isolate all dataref manipulations for 27 | * all plugin object drawing to one place, potentially providing huge 28 | * performance gains. 29 | * 30 | * Here's how it works: 31 | * 32 | * When an instance is created, it provides a list of all datarefs you want to 33 | * manipulate in for the OBJ in the future. This list of datarefs replaces the 34 | * ad-hoc collections of dataref objects previously used by art assets. Then, 35 | * per-frame, you can manipulate the instance by passing in a "block" of 36 | * packed floats representing the current values of the datarefs for your 37 | * instance. (Note that the ordering of this set of packed floats must exactly 38 | * match the ordering of the datarefs when you created your instance.) 39 | * 40 | */ 41 | 42 | #include "XPLMDefs.h" 43 | #include "XPLMScenery.h" 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /*************************************************************************** 50 | * Instance Creation and Destruction 51 | ***************************************************************************/ 52 | /* 53 | * Registers and unregisters instances. 54 | * 55 | */ 56 | 57 | 58 | /* 59 | * XPLMInstanceRef 60 | * 61 | * An opaque handle to an instance. 62 | * 63 | */ 64 | typedef void * XPLMInstanceRef; 65 | 66 | /* 67 | * XPLMCreateInstance 68 | * 69 | * XPLMCreateInstance creates a new instance, managed by your plug-in, and 70 | * returns a handle to the instance. A few important requirements: 71 | * 72 | * * The object passed in must be fully loaded and returned from the XPLM 73 | * before you can create your instance; you cannot pass a null obj ref, nor 74 | * can you change the ref later. 75 | * 76 | * * If you use any custom datarefs in your object, they must be registered 77 | * before the object is loaded. This is true even if their data will be 78 | * provided via the instance dataref list. 79 | * 80 | * * The instance dataref array must be a valid ptr to an array of at least 81 | * one item that is null terminated. That is, if you do not want any 82 | * datarefs, you must passa ptr to an array with a null item. You cannot 83 | * pass null for this. 84 | * 85 | */ 86 | XPLM_API XPLMInstanceRef XPLMCreateInstance( 87 | XPLMObjectRef obj, 88 | const char ** datarefs); 89 | 90 | /* 91 | * XPLMDestroyInstance 92 | * 93 | * XPLMDestroyInstance destroys and deallocates your instance; once called, 94 | * you are still responsible for releasing the OBJ ref. 95 | * 96 | * Tip: you can release your OBJ ref after you call XPLMCreateInstance as long 97 | * as you never use it again; the instance will maintain its own reference to 98 | * the OBJ and the object OBJ be deallocated when the instance is destroyed. 99 | * 100 | */ 101 | XPLM_API void XPLMDestroyInstance( 102 | XPLMInstanceRef instance); 103 | 104 | /*************************************************************************** 105 | * Instance Manipulation 106 | ***************************************************************************/ 107 | 108 | /* 109 | * XPLMInstanceSetPosition 110 | * 111 | * Updates both the position of the instance and all datarefs you registered 112 | * for it. Call this from a flight loop callback or UI callback. 113 | * 114 | * __DO NOT__ call XPLMInstanceSetPosition from a drawing callback; the whole 115 | * point of instancing is that you do not need any drawing callbacks. Setting 116 | * instance data from a drawing callback may have undefined consequences, and 117 | * the drawing callback hurts FPS unnecessarily. 118 | * 119 | * The memory pointed to by the data pointer must be large enough to hold one 120 | * float for every data ref you have registered, and must contain valid 121 | * floating point data. 122 | * 123 | * BUG: before X-Plane 11.50, if you have no dataref registered, you must 124 | * still pass a valid pointer for data and not null. 125 | * 126 | */ 127 | XPLM_API void XPLMInstanceSetPosition( 128 | XPLMInstanceRef instance, 129 | const XPLMDrawInfo_t * new_position, 130 | const float * data); 131 | 132 | #ifdef __cplusplus 133 | } 134 | #endif 135 | 136 | #endif 137 | -------------------------------------------------------------------------------- /SDK/Delphi/Widgets/XPWidgetUtils.pas: -------------------------------------------------------------------------------- 1 | { 2 | Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See 3 | license.txt for usage. X-Plane SDK Version: 2.1.1 4 | } 5 | 6 | UNIT XPWidgetUtils; 7 | INTERFACE 8 | { 9 | ## USAGE NOTES 10 | 11 | The XPWidgetUtils library contains useful functions that make writing and 12 | using widgets less of a pain. 13 | 14 | One set of functions are the widget behavior functions. These functions 15 | each add specific useful behaviors to widgets. They can be used in two 16 | manners: 17 | 18 | 1. You can add a widget behavior function to a widget as a callback proc 19 | using the XPAddWidgetCallback function. The widget will gain that 20 | behavior. Remember that the last function you add has highest priority. 21 | You can use this to change or augment the behavior of an existing 22 | finished widget. 23 | 2. You can call a widget function from inside your own widget function. 24 | This allows you to include useful behaviors in custom-built widgets. A 25 | number of the standard widgets get their behavior from this library. To 26 | do this, call the behavior function from your function first. If it 27 | returns 1, that means it handled the event and you don't need to; simply 28 | return 1. 29 | } 30 | 31 | USES 32 | XPWidgetDefs; 33 | {$A4} 34 | {___________________________________________________________________________ 35 | * GENERAL UTILITIES 36 | ___________________________________________________________________________} 37 | 38 | 39 | { 40 | XPWidgetCreate_t 41 | 42 | This structure contains all of the parameters needed to create a wiget. It 43 | is used with XPUCreateWidgets to create widgets in bulk from an array. All 44 | parameters correspond to those of XPCreateWidget except for the container 45 | index. 46 | 47 | If the container index is equal to the index of a widget in the array, the 48 | widget in the array passed to XPUCreateWidgets is used as the parent of 49 | this widget. Note that if you pass an index greater than your own position 50 | in the array, the parent you are requesting will not exist yet. 51 | 52 | If the container index is NO_PARENT, the parent widget is specified as 53 | NULL. If the container index is PARAM_PARENT, the widget passed into 54 | XPUCreateWidgets is used. 55 | } 56 | TYPE 57 | XPWidgetCreate_t = RECORD 58 | left : Integer; 59 | top : Integer; 60 | right : Integer; 61 | bottom : Integer; 62 | visible : Integer; 63 | descriptor : XPLMString; 64 | { Whether ethis widget is a root wiget } 65 | isRoot : Integer; 66 | { The index of the widget to contain within, or a constant } 67 | containerIndex : Integer; 68 | widgetClass : XPWidgetClass; 69 | END; 70 | PXPWidgetCreate_t = ^XPWidgetCreate_t; 71 | 72 | CONST 73 | NO_PARENT = -1; 74 | 75 | PARAM_PARENT = -2; 76 | 77 | 78 | { 79 | XPUCreateWidgets 80 | 81 | This function creates a series of widgets from a table (see 82 | XPCreateWidget_t above). Pass in an array of widget creation structures and 83 | an array of widget IDs that will receive each widget. 84 | 85 | Widget parents are specified by index into the created widget table, 86 | allowing you to create nested widget structures. You can create multiple 87 | widget trees in one table. Generally you should create widget trees from 88 | the top down. 89 | 90 | You can also pass in a widget ID that will be used when the widget's parent 91 | is listed as PARAM_PARENT; this allows you to embed widgets created with 92 | XPUCreateWidgets in a widget created previously. 93 | } 94 | PROCEDURE XPUCreateWidgets( 95 | inWidgetDefs : PXPWidgetCreate_t; 96 | inCount : Integer; 97 | inParamParent : XPWidgetID; 98 | ioWidgets : PXPWidgetID); 99 | cdecl; external XPWIDGETS.DLL; 100 | 101 | { 102 | XPUMoveWidgetBy 103 | 104 | Simply moves a widget by an amount, +x = right, +y=up, without resizing the 105 | widget. 106 | } 107 | PROCEDURE XPUMoveWidgetBy( 108 | inWidget : XPWidgetID; 109 | inDeltaX : Integer; 110 | inDeltaY : Integer); 111 | cdecl; external XPWIDGETS.DLL; 112 | 113 | {___________________________________________________________________________ 114 | * LAYOUT MANAGERS 115 | ___________________________________________________________________________} 116 | { 117 | The layout managers are widget behavior functions for handling where 118 | widgets move. Layout managers can be called from a widget function or 119 | attached to a widget later. 120 | } 121 | 122 | 123 | { 124 | XPUFixedLayout 125 | 126 | This function causes the widget to maintain its children in fixed position 127 | relative to itself as it is resized. Use this on the top level 'window' 128 | widget for your window. 129 | } 130 | FUNCTION XPUFixedLayout( 131 | inMessage : XPWidgetMessage; 132 | inWidget : XPWidgetID; 133 | inParam1 : intptr_t; 134 | inParam2 : intptr_t) : Integer; 135 | cdecl; external XPWIDGETS.DLL; 136 | 137 | {___________________________________________________________________________ 138 | * WIDGET PROC BEHAVIORS 139 | ___________________________________________________________________________} 140 | { 141 | These widget behavior functions add other useful behaviors to widgets. 142 | These functions cannot be attached to a widget; they must be called from 143 | your widget function. 144 | } 145 | 146 | 147 | { 148 | XPUSelectIfNeeded 149 | 150 | This causes the widget to bring its window to the foreground if it is not 151 | already. inEatClick specifies whether clicks in the background should be 152 | consumed by bringin the window to the foreground. 153 | } 154 | FUNCTION XPUSelectIfNeeded( 155 | inMessage : XPWidgetMessage; 156 | inWidget : XPWidgetID; 157 | inParam1 : intptr_t; 158 | inParam2 : intptr_t; 159 | inEatClick : Integer) : Integer; 160 | cdecl; external XPWIDGETS.DLL; 161 | 162 | { 163 | XPUDefocusKeyboard 164 | 165 | This causes a click in the widget to send keyboard focus back to X-Plane. 166 | This stops editing of any text fields, etc. 167 | } 168 | FUNCTION XPUDefocusKeyboard( 169 | inMessage : XPWidgetMessage; 170 | inWidget : XPWidgetID; 171 | inParam1 : intptr_t; 172 | inParam2 : intptr_t; 173 | inEatClick : Integer) : Integer; 174 | cdecl; external XPWIDGETS.DLL; 175 | 176 | { 177 | XPUDragWidget 178 | 179 | XPUDragWidget drags the widget in response to mouse clicks. Pass in not 180 | only the event, but the global coordinates of the drag region, which might 181 | be a sub-region of your widget (for example, a title bar). 182 | } 183 | FUNCTION XPUDragWidget( 184 | inMessage : XPWidgetMessage; 185 | inWidget : XPWidgetID; 186 | inParam1 : intptr_t; 187 | inParam2 : intptr_t; 188 | inLeft : Integer; 189 | inTop : Integer; 190 | inRight : Integer; 191 | inBottom : Integer) : Integer; 192 | cdecl; external XPWIDGETS.DLL; 193 | 194 | 195 | IMPLEMENTATION 196 | 197 | END. 198 | -------------------------------------------------------------------------------- /SDK/Delphi/XPLM/XPLMCamera.pas: -------------------------------------------------------------------------------- 1 | { 2 | Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See 3 | license.txt for usage. X-Plane SDK Version: 2.1.1 4 | } 5 | 6 | UNIT XPLMCamera; 7 | INTERFACE 8 | { 9 | The XPLMCamera APIs allow plug-ins to control the camera angle in X-Plane. 10 | This has a number of applications, including but not limited to: 11 | 12 | - Creating new views (including dynamic/user-controllable views) for the 13 | user. 14 | - Creating applications that use X-Plane as a renderer of scenery, 15 | aircrafts, or both. 16 | 17 | The camera is controlled via six parameters: a location in OpenGL 18 | coordinates and pitch, roll and yaw, similar to an airplane's position. 19 | OpenGL coordinate info is described in detail in the XPLMGraphics 20 | documentation; generally you should use the XPLMGraphics routines to 21 | convert from world to local coordinates. The camera's orientation starts 22 | facing level with the ground directly up the negative-Z axis (approximately 23 | north) with the horizon horizontal. It is then rotated clockwise for yaw, 24 | pitched up for positive pitch, and rolled clockwise around the vector it is 25 | looking along for roll. 26 | 27 | You control the camera either either until the user selects a new view or 28 | permanently (the later being similar to how UDP camera control works). You 29 | control the camera by registering a callback per frame from which you 30 | calculate the new camera positions. This guarantees smooth camera motion. 31 | 32 | Use the XPLMDataAccess APIs to get information like the position of the 33 | aircraft, etc. for complex camera positioning. 34 | 35 | Note: if your goal is to move the virtual pilot in the cockpit, this API is 36 | not needed; simply update the datarefs for the pilot's head position. 37 | 38 | For custom exterior cameras, set the camera's mode to an external view 39 | first to get correct sound and 2-d panel behavior. 40 | } 41 | 42 | USES 43 | XPLMDefs; 44 | {$A4} 45 | {___________________________________________________________________________ 46 | * CAMERA CONTROL 47 | ___________________________________________________________________________} 48 | 49 | { 50 | XPLMCameraControlDuration 51 | 52 | This enumeration states how long you want to retain control of the camera. 53 | You can retain it indefinitely or until the user selects a new view. 54 | } 55 | TYPE 56 | XPLMCameraControlDuration = ( 57 | { Control the camera until the user picks a new view. } 58 | xplm_ControlCameraUntilViewChanges = 1 59 | 60 | { Control the camera until your plugin is disabled or another plugin forcably} 61 | { takes control. } 62 | ,xplm_ControlCameraForever = 2 63 | 64 | ); 65 | PXPLMCameraControlDuration = ^XPLMCameraControlDuration; 66 | 67 | { 68 | XPLMCameraPosition_t 69 | 70 | This structure contains a full specification of the camera. X, Y, and Z are 71 | the camera's position in OpenGL coordiantes; pitch, roll, and yaw are 72 | rotations from a camera facing flat north in degrees. Positive pitch means 73 | nose up, positive roll means roll right, and positive yaw means yaw right, 74 | all in degrees. Zoom is a zoom factor, with 1.0 meaning normal zoom and 2.0 75 | magnifying by 2x (objects appear larger). 76 | } 77 | XPLMCameraPosition_t = RECORD 78 | x : Single; 79 | y : Single; 80 | z : Single; 81 | pitch : Single; 82 | heading : Single; 83 | roll : Single; 84 | zoom : Single; 85 | END; 86 | PXPLMCameraPosition_t = ^XPLMCameraPosition_t; 87 | 88 | { 89 | XPLMCameraControl_f 90 | 91 | You use an XPLMCameraControl function to provide continuous control over 92 | the camera. You are passed in a structure in which to put the new camera 93 | position; modify it and return 1 to reposition the camera. Return 0 to 94 | surrender control of the camera; camera control will be handled by X-Plane 95 | on this draw loop. The contents of the structure as you are called are 96 | undefined. 97 | 98 | If X-Plane is taking camera control away from you, this function will be 99 | called with inIsLosingControl set to 1 and ioCameraPosition NULL. 100 | } 101 | XPLMCameraControl_f = FUNCTION( 102 | outCameraPosition : PXPLMCameraPosition_t; { Can be nil } 103 | inIsLosingControl : Integer; 104 | inRefcon : pointer) : Integer; cdecl; 105 | 106 | { 107 | XPLMControlCamera 108 | 109 | This function repositions the camera on the next drawing cycle. You must 110 | pass a non-null control function. Specify in inHowLong how long you'd like 111 | control (indefinitely or until a new view mode is set by the user). 112 | } 113 | PROCEDURE XPLMControlCamera( 114 | inHowLong : XPLMCameraControlDuration; 115 | inControlFunc : XPLMCameraControl_f; 116 | inRefcon : pointer); 117 | cdecl; external XPLM_DLL; 118 | 119 | { 120 | XPLMDontControlCamera 121 | 122 | This function stops you from controlling the camera. If you have a camera 123 | control function, it will not be called with an inIsLosingControl flag. 124 | X-Plane will control the camera on the next cycle. 125 | 126 | For maximum compatibility you should not use this routine unless you are in 127 | posession of the camera. 128 | } 129 | PROCEDURE XPLMDontControlCamera; 130 | cdecl; external XPLM_DLL; 131 | 132 | { 133 | XPLMIsCameraBeingControlled 134 | 135 | This routine returns 1 if the camera is being controlled, zero if it is 136 | not. If it is and you pass in a pointer to a camera control duration, the 137 | current control duration will be returned. 138 | } 139 | FUNCTION XPLMIsCameraBeingControlled( 140 | outCameraControlDuration: PXPLMCameraControlDuration) : Integer; { Can be nil } 141 | cdecl; external XPLM_DLL; 142 | 143 | { 144 | XPLMReadCameraPosition 145 | 146 | This function reads the current camera position. 147 | } 148 | PROCEDURE XPLMReadCameraPosition( 149 | outCameraPosition : PXPLMCameraPosition_t); 150 | cdecl; external XPLM_DLL; 151 | 152 | 153 | IMPLEMENTATION 154 | 155 | END. 156 | -------------------------------------------------------------------------------- /SDK/Delphi/XPLM/XPLMInstance.pas: -------------------------------------------------------------------------------- 1 | { 2 | Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See 3 | license.txt for usage. X-Plane SDK Version: 2.1.1 4 | } 5 | 6 | UNIT XPLMInstance; 7 | INTERFACE 8 | { 9 | This API provides instanced drawing of X-Plane objects (.obj files). In 10 | contrast to old drawing APIs, which required you to draw your own objects 11 | per-frame, the instancing API allows you to simply register an OBJ for 12 | drawing, then move or manipulate it later (as needed). 13 | 14 | This provides one tremendous benefit: it keeps all dataref operations for 15 | your object in one place. Because datarefs are main thread only, allowing 16 | dataref access anywhere is a serious performance bottleneck for the 17 | simulator---the whole simulator has to pause and wait for each dataref 18 | access. This performance penalty will only grow worse as X-Plane moves 19 | toward an ever more heavily multithreaded engine. 20 | 21 | The instancing API allows X-Plane to isolate all dataref manipulations for 22 | all plugin object drawing to one place, potentially providing huge 23 | performance gains. 24 | 25 | Here's how it works: 26 | 27 | When an instance is created, it provides a list of all datarefs you want to 28 | manipulate in for the OBJ in the future. This list of datarefs replaces the 29 | ad-hoc collections of dataref objects previously used by art assets. Then, 30 | per-frame, you can manipulate the instance by passing in a "block" of 31 | packed floats representing the current values of the datarefs for your 32 | instance. (Note that the ordering of this set of packed floats must exactly 33 | match the ordering of the datarefs when you created your instance.) 34 | } 35 | 36 | USES 37 | XPLMDefs, XPLMScenery; 38 | {$A4} 39 | {___________________________________________________________________________ 40 | * Instance Creation and Destruction 41 | ___________________________________________________________________________} 42 | { 43 | Registers and unregisters instances. 44 | } 45 | 46 | 47 | TYPE 48 | { 49 | XPLMInstanceRef 50 | 51 | An opaque handle to an instance. 52 | } 53 | XPLMInstanceRef = pointer; 54 | PXPLMInstanceRef = ^XPLMInstanceRef; 55 | 56 | { 57 | XPLMCreateInstance 58 | 59 | XPLMCreateInstance creates a new instance, managed by your plug-in, and 60 | returns a handle to the instance. A few important requirements: 61 | 62 | * The object passed in must be fully loaded and returned from the XPLM 63 | before you can create your instance; you cannot pass a null obj ref, nor 64 | can you change the ref later. 65 | 66 | * If you use any custom datarefs in your object, they must be registered 67 | before the object is loaded. This is true even if their data will be 68 | provided via the instance dataref list. 69 | 70 | * The instance dataref array must be a valid ptr to an array of at least 71 | one item that is null terminated. That is, if you do not want any 72 | datarefs, you must passa ptr to an array with a null item. You cannot 73 | pass null for this. 74 | } 75 | FUNCTION XPLMCreateInstance( 76 | obj : XPLMObjectRef; 77 | datarefs : PXPLMString) : XPLMInstanceRef; 78 | cdecl; external XPLM_DLL; 79 | 80 | { 81 | XPLMDestroyInstance 82 | 83 | XPLMDestroyInstance destroys and deallocates your instance; once called, 84 | you are still responsible for releasing the OBJ ref. 85 | 86 | Tip: you can release your OBJ ref after you call XPLMCreateInstance as long 87 | as you never use it again; the instance will maintain its own reference to 88 | the OBJ and the object OBJ be deallocated when the instance is destroyed. 89 | } 90 | PROCEDURE XPLMDestroyInstance( 91 | instance : XPLMInstanceRef); 92 | cdecl; external XPLM_DLL; 93 | 94 | {___________________________________________________________________________ 95 | * Instance Manipulation 96 | ___________________________________________________________________________} 97 | 98 | { 99 | XPLMInstanceSetPosition 100 | 101 | Updates both the position of the instance and all datarefs you registered 102 | for it. Call this from a flight loop callback or UI callback. 103 | 104 | __DO NOT__ call XPLMInstanceSetPosition from a drawing callback; the whole 105 | point of instancing is that you do not need any drawing callbacks. Setting 106 | instance data from a drawing callback may have undefined consequences, and 107 | the drawing callback hurts FPS unnecessarily. 108 | 109 | The memory pointed to by the data pointer must be large enough to hold one 110 | float for every data ref you have registered, and must contain valid 111 | floating point data. 112 | 113 | BUG: before X-Plane 11.50, if you have no dataref registered, you must 114 | still pass a valid pointer for data and not null. 115 | } 116 | PROCEDURE XPLMInstanceSetPosition( 117 | instance : XPLMInstanceRef; 118 | new_position : PXPLMDrawInfo_t; 119 | data : PSingle); 120 | cdecl; external XPLM_DLL; 121 | 122 | 123 | IMPLEMENTATION 124 | 125 | END. 126 | -------------------------------------------------------------------------------- /SDK/FF_A320/SharedValue.h: -------------------------------------------------------------------------------- 1 | #ifndef __SharedValue__ 2 | #define __SharedValue__ 3 | //-------------------------------------------------------------------------- 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define bool bool_t 12 | 13 | #if !IBM 14 | #undef __stdcall 15 | #define __stdcall 16 | #endif /* !WIN */ 17 | 18 | #define Value_Type_Deleted 0 19 | #define Value_Type_Object 1 20 | #define Value_Type_sint8 2 21 | #define Value_Type_uint8 3 22 | #define Value_Type_sint16 4 23 | #define Value_Type_uint16 5 24 | #define Value_Type_sint32 6 25 | #define Value_Type_uint32 7 26 | #define Value_Type_float32 8 27 | #define Value_Type_float64 9 28 | #define Value_Type_String 10 29 | #define Value_Type_Time 11 30 | //-------------------------------------------------------------------------- 31 | 32 | #define Value_Flag_State (1<<1) // state parameter 33 | #define Value_Flag_Sync (1<<2) // force sync 34 | #define Value_Flag_Step (1<<3) // step parameter 35 | #define Value_Flag_External (1<<4) // external parameter 36 | #define Value_Flag_Config (1<<5) // config parameter 37 | //-------------------------------------------------------------------------- 38 | 39 | #define Value_Unit_Object (1<<0) 40 | #define Value_Unit_Failure (1<<1) 41 | #define Value_Unit_Button (1<<2) 42 | #define Value_Unit_Ratio (1<<3) // floating ratio 43 | #define Value_Unit_State (1<<4) // sinteger state 44 | #define Value_Unit_Flags (1<<5) // uinteger flags 45 | #define Value_Unit_Ident (1<<6) // achar ident 46 | #define Value_Unit_Length (1<<7) // Meter 47 | #define Value_Unit_Speed (1<<8) // Meter/Second 48 | #define Value_Unit_Accel (1<<9) // Meter/Second^2 49 | #define Value_Unit_Force (1<<10) // Newton 50 | #define Value_Unit_Weight (1<<11) // Kilogram 51 | #define Value_Unit_Angle (1<<12) // Degrees 52 | #define Value_Unit_AngularSpeed (1<<13) // Degrees/Second 53 | #define Value_Unit_AngularAccel (1<<14) // Degrees/Second^2 54 | #define Value_Unit_Temperature (1<<15) // Kelvin 55 | #define Value_Unit_Pressure (1<<16) // Pascal 56 | #define Value_Unit_Flow (1<<17) // Kilogram/Second 57 | #define Value_Unit_Voltage (1<<18) // Volt 58 | #define Value_Unit_Frequency (1<<19) // Herz 59 | #define Value_Unit_Current (1<<20) // Amper 60 | #define Value_Unit_Power (1<<21) // Watt 61 | #define Value_Unit_Density (1<<22) // Kg/m3 62 | #define Value_Unit_Volume (1<<23) // m3 63 | #define Value_Unit_Conduction (1<<24) // 1/Resistance 64 | #define Value_Unit_Capacity (1<<25) // Amper/Second 65 | #define Value_Unit_Heat (1<<26) // Kelvin/(Kilogram/Second) 66 | #define Value_Unit_Position (1<<27) // Radians 67 | #define Value_Unit_TimeDelta (1<<28) // 1/10000000 of second 68 | #define Value_Unit_TimeStart (1<<29) // 1/10000000 of second 69 | #define Value_Unit_Label (1<<30) // ARINC 429 label 70 | //-------------------------------------------------------------------------- 71 | 72 | typedef unsigned int (__stdcall *SharedDataVersionProc)(); 73 | typedef void (__stdcall *SharedDataUpdateProc)(double step, void *tag); 74 | typedef void (__stdcall *SharedDataAddUpdateProc)(SharedDataUpdateProc proc, void *tag); 75 | typedef void (__stdcall *SharedDataDelUpdateProc)(SharedDataUpdateProc proc, void *tag); 76 | typedef unsigned int (__stdcall *SharedValuesCountProc)(); 77 | typedef int (__stdcall *SharedValueIdByIndexProc)(unsigned int index); 78 | typedef int (__stdcall *SharedValueIdByNameProc)(const char *name); 79 | typedef const char *(__stdcall *SharedValueNameProc)(int id); 80 | typedef const char *(__stdcall *SharedValueDescProc)(int id); 81 | typedef unsigned int (__stdcall *SharedValueTypeProc)(int id); 82 | typedef unsigned int (__stdcall *SharedValueFlagsProc)(int id); 83 | typedef unsigned int (__stdcall *SharedValueUnitsProc)(int id); 84 | typedef int (__stdcall *SharedValueParentProc)(int id); 85 | typedef void (__stdcall *SharedValueSetProc)(int id, const void *src); 86 | typedef void (__stdcall *SharedValueGetProc)(int id, void *dst); 87 | typedef unsigned int (__stdcall *SharedValueGetSizeProc)(int id); 88 | typedef void (__stdcall *SharedValueReaderProc)(void *dst, unsigned int size, void *tag); 89 | typedef void (__stdcall *SharedValueWriterProc)(const void *src, unsigned int size, void *tag); 90 | typedef bool (__stdcall *SharedValueObjectLoadStateProc)(int id, SharedValueReaderProc src, void *tag); 91 | typedef void (__stdcall *SharedValueObjectSaveStateProc)(int id, SharedValueWriterProc dst, void *tag); 92 | //-------------------------------------------------------------------------- 93 | 94 | #define XPLM_FF_SIGNATURE "FlightFactor.A320.ultimate" // for XPLMFindPluginBySignature 95 | #define XPLM_FF_MSG_GET_SHARED_INTERFACE 1001 // for XPLMSendMessageToPlugin, use pointer to SharedValuesInterface as parameter to fill in 96 | //-------------------------------------------------------------------------- 97 | 98 | typedef struct 99 | { 100 | SharedDataVersionProc DataVersion; // to get actual dataset version 101 | SharedDataAddUpdateProc DataAddUpdate; // register an update callback called at each frame in sync with platform and aircraft values update, for using values functions below 102 | SharedDataDelUpdateProc DataDelUpdate; // remove a registred update callback 103 | SharedValuesCountProc ValuesCount; // get count off all values (including deleted) 104 | SharedValueIdByIndexProc ValueIdByIndex; // get value id by it's index (0 up to ValuesCount), or -1 if not exists or removed 105 | SharedValueIdByNameProc ValueIdByName; // get value id by it's name, or -1 if not exists or removed 106 | SharedValueNameProc ValueName; // get value name 107 | SharedValueDescProc ValueDesc; // get value description 108 | SharedValueTypeProc ValueType; // get value type, one of Value_Type_ 109 | SharedValueFlagsProc ValueFlags; // get value flags, OR Value_Flag_ 110 | SharedValueUnitsProc ValueUnits; // get value units, OR Value_Unit_ 111 | SharedValueParentProc ValueParent; // get id of the parent object value 112 | SharedValueSetProc ValueSet; // set value 113 | SharedValueGetProc ValueGet; // get value 114 | SharedValueGetSizeProc ValueGetSize; // get actual size of the value data (for strings) 115 | SharedValueObjectLoadStateProc ValueObjectLoadState; // deserialize object state 116 | SharedValueObjectSaveStateProc ValueObjectSaveState; // serialize object state 117 | 118 | } SharedValuesInterface; 119 | //-------------------------------------------------------------------------- 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif 126 | //-------------------------------------------------------------------------- 127 | -------------------------------------------------------------------------------- /SDK/FF_A320/TCAS_obj_intf.txt: -------------------------------------------------------------------------------- 1 | Inputs: 2 | 3 | binary mValid; // Data acquisition valid 4 | binary mCancel; // Cancel advisory 5 | binary mSuppress; // Suppress audio 6 | binary mOnGround; // gears compressed 7 | binary mGearsDown; // gears down 8 | floating mPitch; // Pitch 9 | floating mRoll; // Roll 10 | floating mHeading; // Heading 11 | floating mHeight; // RA Height 12 | floating mAltitude; // Altitude 13 | uinteger mShow; // Display mode, 0 - THRT, 1 - ALL, 2 - ABV, 3 - BLW 14 | uinteger mMode; // Mode, 0 - STBY, 1 - TA, 2 - TA/RA 15 | 16 | Outputs: 17 | 18 | /* 19 | * PFD & ND state 20 | */ 21 | uint32 mState; // System state, 0 - STBY, 1 - TA, 2 - TA/RA 22 | uint32 mAdvisory; // Advisory level, 0 - none, 1 - TA, 2 - RA 23 | floating mAdvisoryTrend[2]; // Advisory green band pos (m/s, top & bottom) 24 | uint32 mAdvisoryAreas; // Advisory area flags, Upper RED - (1 << 0), 25 | // GREEN - (1 << 1), Bottom RED - (1 << 2) 26 | binary mAlert; // TCAS audio alert signal 27 | 28 | /* 29 | * Intruder update. We can update one intruder per frame. 30 | */ 31 | uint32 mType; // Intruder update type, 0 - none, 1 - OTHER, 32 | // 2 - PROXIMATE, 3 - TRAFFIC ADV, 4 - RESOLUTION ADV 33 | floating mRelBearing; // Intruder update relative bearing 34 | floating mRelDistance; // Intruder update relative distance 35 | floating mRelAltitude; // Intruder update relative altitude 36 | sint32 mTrend; // Intruder update trend arrow, 37 | // climbing: +1, level: 0, descending: -1 38 | uint32 mIndex; // Intruder update index 39 | 40 | Object interface: Aircraft.Navigation.TCAS 41 | 42 | { 43 | AddParameter("Valid", "Data acquisition valid", &mValid, 44 | Value_Flag_Step, Value_Unit_State); 45 | AddParameter("Cancel", "Cancel advisory", &mCancel, Value_Flag_Step, 46 | Value_Unit_State); 47 | AddParameter("Suppress", "Suppres audio", &mSuppress, Value_Flag_Step, 48 | Value_Unit_State); 49 | AddParameter("OnGround", "Gears compressed", &mOnGround, 50 | Value_Flag_Step, Value_Unit_State); 51 | AddParameter("GearsDown", "Gears down", &mGearsDown, Value_Flag_Step, 52 | Value_Unit_State); 53 | AddParameter("Pitch", "Pitch", &mPitch, Value_Flag_Step, 54 | Value_Unit_Angle); 55 | AddParameter("Roll", "Roll", &mRoll, Value_Flag_Step, 56 | Value_Unit_Angle); 57 | AddParameter("Heading", "Heading", &mHeading, Value_Flag_Step, 58 | Value_Unit_Angle); 59 | AddParameter("Height", "RA Height", &mHeight, Value_Flag_Step, 60 | Value_Unit_Length); 61 | AddParameter("Altitude", "Altitude", &mAltitude, Value_Flag_Step, 62 | Value_Unit_Length); 63 | AddParameter("Show", "Intruders display mode", &mShow, Value_Flag_Step, 64 | Value_Unit_Length); 65 | AddParameter("Mode", "Advisory mode", &mMode, Value_Flag_Step, 66 | Value_Unit_Length); 67 | } 68 | 69 | { 70 | AddParameter("Type", "Intruder update type", &mType, Value_Flag_Step, 71 | Value_Unit_State); 72 | AddParameter("RelBearing", "Intruder update relative bearing", 73 | &mRelBearing, Value_Flag_Step, Value_Unit_Angle); 74 | AddParameter("RelDistance", "Intruder update relative distance", 75 | &mRelDistance, Value_Flag_Step, Value_Unit_Length); 76 | AddParameter("RelAltitude", "Intruder update relative altitude", 77 | &mRelAltitude, Value_Flag_Step, Value_Unit_Length); 78 | AddParameter("Trend", "Intruder update trend", &mTrend, 79 | Value_Flag_Step, Value_Unit_State); 80 | AddParameter("Index", "Intruder update index", &mIndex, 81 | Value_Flag_Step, Value_Unit_State); 82 | 83 | AddParameter("State", "System state", &mState, Value_Flag_Step, 84 | Value_Unit_State); 85 | AddParameter("Advisory", "Advisory level", &mAdvisory, Value_Flag_Step, 86 | Value_Unit_State); 87 | AddParameter("AdvisoryTrendUP", "Advisory up vertical trend", 88 | &mAdvisoryTrend[0], Value_Flag_Step, Value_Unit_Speed); 89 | AddParameter("AdvisoryTrendDN", "Advisory dn vertical trend", 90 | &mAdvisoryTrend[1], Value_Flag_Step, Value_Unit_Speed); 91 | AddParameter("AdvisoryAreas", "Advisory area flags", &mAdvisoryAreas, 92 | Value_Flag_Step, Value_Unit_Speed); 93 | } 94 | 95 | { 96 | AddParameter("Alert", "TCAS audio alert signal", &mAlert, 97 | Value_Flag_Step, Value_Unit_State); 98 | } 99 | -------------------------------------------------------------------------------- /SDK/Libraries/Mac/XPLM.framework/XPLM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/SDK/Libraries/Mac/XPLM.framework/XPLM -------------------------------------------------------------------------------- /SDK/Libraries/Mac/XPWidgets.framework/XPWidgets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/SDK/Libraries/Mac/XPWidgets.framework/XPWidgets -------------------------------------------------------------------------------- /SDK/Libraries/Win/XPLM_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/SDK/Libraries/Win/XPLM_64.lib -------------------------------------------------------------------------------- /SDK/Libraries/Win/XPWidgets_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skiselkov/X-TCAS/1bfb4e0516acef18f9efd66bf7dc44848e0af0fd/SDK/Libraries/Win/XPWidgets_64.lib -------------------------------------------------------------------------------- /SDK/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Sandy Barbour and Ben Supnik 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Neither the names of the authors nor that of X-Plane or Laminar Research 14 | may be used to endorse or promote products derived from this software 15 | without specific prior written permission from the authors or 16 | Laminar Research, respectively. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /X-TCAS.cfg: -------------------------------------------------------------------------------- 1 | # This is a sample X-TCAS configuration file. This lets you statically 2 | # configure X-TCAS to avoid having to write to its configuration datarefs 3 | # dynamically, since most of the configuration options are usually fixed 4 | # for a particular aircraft model. 5 | 6 | # All of the configuration options bellow are commented out, which sets 7 | # them to their default values. 8 | 9 | 10 | # By default, the TCAS computer needs power on 11 | # sim/cockpit2/electrical/bus_volts[0]. You can change the bus number here. 12 | # If you set this variable to some non-existent bus index (e.g. busnr=-1), 13 | # this disables X-TCAS's electrical power-on check and X-TCAS will always 14 | # operate. 15 | # This does NOT affect individual VSI screens, only the TCAS computer, which 16 | # does the callouts and feeds the VSI screens with data. 17 | 18 | # busnr = 0 19 | 20 | 21 | # When checking for power on the electrical bus, X-TCAS needs at least 22 | # 22 Volts. You change the minimum voltage needed for X-TCAS to operate. 23 | 24 | # min_volts = 22 25 | 26 | 27 | # By default X-TCAS monitors several datarefs to determine if the TCAS 28 | # equipment has failed. To override this and take manual control you can 29 | # define the name of the dataref that X-TCAS should monitor. This dataref 30 | # must follow the X-Plane failure enum format. 31 | 32 | # fail_dr = 33 | 34 | 35 | # VSI-related configuration variables. X-TCAS allows you to render up to 36 | # 4 independent VSIs to the panel texture, each with separate scaling, 37 | # positioning and state. Therefore, the following configuration block 38 | # can repeat up to 4 times. 39 | 40 | # The X coordinate on the panel texture of the left edget of the VSI. 41 | # vsi/0/x = 0 42 | 43 | # The Y coordinate on the panel texture of the bottom edget of the VSI. 44 | # vsi/0/y = 0 45 | 46 | # The pixel size of the rendering of the VSI on the panel texture. Set 47 | # this to zero to shut down a particular VSI instance. 48 | # vsi/0/sz = 0 49 | 50 | # The default britghtness of the VSI. must be a number from 0..100. 51 | # vsi/0/brt = 50 52 | 53 | # The default range scale displayed on the VSI. This is an enum index 54 | # between 0..4. The exact range values depend on the VSI display style. 55 | # vsi/0/scale = 1 56 | 57 | # Vertical speed value source dataref. 58 | # vsi/0/vs_src = sim/cockpit2/gauges/indicators/vvi_fpm_pilot 59 | 60 | # Determines the data format used within the vs_src dataref. The possible 61 | # values are: 0 = feet-per-minute, 1 = meters-per-second, 62 | # 2 = feet per second, 3 = meters per minute. This does not change the 63 | # vertical speed units used on the rendered VSI display (which are always 64 | # in feet-per-minute). 65 | # vsi/0/vs_src_fmt = 0 66 | 67 | # Sets electrical bus the VSI *screen* monitors for power. The default is 68 | # bus 0 for VSI 0, bus 1 for VSI 1, etc. 69 | # vsi/0/busnr = 0 70 | 71 | # Sets which dataref X-TCAS monitors to determine if the VSI display has 72 | # failed. This must be in the X-Plane failure enum format. The failure of 73 | # the VSI does not affect the core TCAS computer (which will continue to 74 | # issue traffic & resolution advisories, nor does it affect any other VSI 75 | # instance. 76 | # vsi/0/fail_dr = sim/operation/failures/rel_ss_vvi 77 | 78 | # Same set of datarefs as for VSI0, but for VSI1 79 | # vsi/1/x = 0 80 | # vsi/1/y = 0 81 | # vsi/1/sz = 0 82 | # vsi/1/brt = 50 83 | # vsi/1/scale = 1 84 | # vsi/1/vs_src = sim/cockpit2/gauges/indicators/vvi_fpm_copilot 85 | # vsi/1/vs_src_fmt = 0 86 | # vsi/1/busnr = 1 87 | # vsi/1/fail_dr = sim/operation/failures/rel_cop_vvi 88 | 89 | # Same set of datarefs as for VSI0, but for VSI2 90 | # vsi/2/x = 0 91 | # vsi/2/y = 0 92 | # vsi/2/sz = 0 93 | # vsi/2/brt = 50 94 | # vsi/2/scale = 1 95 | # vsi/2/vs_src = sim/cockpit2/gauges/indicators/vvi_fpm_pilot 96 | # vsi/2/vs_src_fmt = 0 97 | # vsi/2/busnr = 2 98 | # vsi/2/fail_dr = sim/operation/failures/rel_ss_vvi 99 | 100 | # Same set of datarefs as for VSI0, but for VSI3 101 | # vsi/3/x = 0 102 | # vsi/3/y = 0 103 | # vsi/3/sz = 0 104 | # vsi/3/brt = 50 105 | # vsi/3/scale = 1 106 | # vsi/3/vs_src = sim/cockpit2/gauges/indicators/vvi_fpm_copilot 107 | # vsi/3/vs_src_fmt = 0 108 | # vsi/3/busnr = 3 109 | # vsi/3/fail_dr = sim/operation/failures/rel_cop_vvi 110 | -------------------------------------------------------------------------------- /build_release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # CDDL HEADER START 4 | # 5 | # This file and its contents are supplied under the terms of the 6 | # Common Development and Distribution License ("CDDL"), version 1.0. 7 | # You may only use this file in accordance with the terms of version 8 | # 1.0 of the CDDL. 9 | # 10 | # A full copy of the text of the CDDL should have accompanied this 11 | # source. A copy of the CDDL is also available via the Internet at 12 | # http://www.illumos.org/license/CDDL. 13 | # 14 | # CDDL HEADER END 15 | # 16 | # Copyright 2024 Saso Kiselkov. All rights reserved. 17 | 18 | function my_realpath() { 19 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 20 | } 21 | 22 | OUTPUT="X-TCAS" 23 | 24 | VSI_MODE="OFF" 25 | VSI_STYLE="" 26 | GTS820_MODE="OFF" 27 | SNDSET="male1" 28 | AUDIO="ON" 29 | OS="$(uname)" 30 | 31 | case "$OS" in 32 | Darwin) 33 | REALPATH=my_realpath 34 | ;; 35 | *) 36 | REALPATH=realpath 37 | ;; 38 | esac 39 | 40 | while getopts "a:v:s:GNh" opt; do 41 | case "$opt" in 42 | a) 43 | LIBACFUTILS="$(${REALPATH} "$OPTARG")" 44 | ;; 45 | v) 46 | VSI_MODE="ON" 47 | VSI_STYLE="$OPTARG" 48 | ;; 49 | s) 50 | SNDSET="$OPTARG" 51 | ;; 52 | G) 53 | VSI_MODE="OFF" 54 | VSI_STYLE="" 55 | GTS820_MODE="ON" 56 | SNDSET="gts820" 57 | ;; 58 | N) 59 | AUDIO="OFF" 60 | ;; 61 | h) 62 | cat << EOF 63 | Usage: $0 -a [-GN] [-v