Uživatelské nástroje

Nástroje pro tento web


xpl_sasl

Sasl

Obecně

  • v projektu je samostatná aplikace „Slava“, která umožňuje vytvořit přístrojový panel propojený s X-Plane Sasl po síti. Funguje nejen vizualizace, ale také ovládání přístrojů.
  • plno komerčních letadel obsahuje Sasl plugin v sobě.
  • Některá jej používají skutečně pro vytváření přístrojů, některé sasl používají pouze jako doplnění speciálních efektů - například 3d zvuk, chvění kabiny, odstranění pilota při pohledu z kokpitu…
  • Aby se zobrazili přístroje ve slava aplikaci, musí být nadefinován panel.lua. V defaultu je k dispozici jeden demo ruský panel. Funguje obecně na jakékoliv letadlo, které používá uvedené dataref.
  • existuje více verzí sasl
      • nejspíš úplně původní větev, pod GPL licencí,
      • vývoj byl ukončen, poslední verze 2.0.3
      • vývoj byl převeden na 1-sim.com
      • nějaký klon nejspíš původní větve, pod GPL
      • obsahuje chyby, mrtvý projekt
      • aktuální oficiální větev pod vedením 1-sim.com, flightfactor aero
        • změny kódu se musí vracet 1-sim
        • autor modifikace se zříká práv na modifikovaný kód.. tj. například sdílení dalším lidem
        • použití pluginu v komerčním projektu vyžaduje souhlas
        • použití pluginu ve free projektu je bez omezení
        • součástí pluginu musí být ta proprietární licence
      • ze zdrojových kódů je odstraněn Slava
      • plánují úplně odstranit podporu pro Slava (remote connection), pokud to nebude nikdo používat

Kompilace Slava

  • stáhnout
svn co http://sasl.googlecode.com/svn/trunk
  • projekt neobsahuje žádný configure, takže se musí upravit cesty a doinstalovat závislosti
  • pro kompilaci slava není potřeba kompilovat xap, který závisí na X-Plane SDK od XSquawkBox
  • minimálně budou potřeba balíčky
apt-get install libluajit-5.1-dev libsoil-dev libsdl2-dev libopenal-dev
  • upravit konfigurační soubor - zohlednit cesty knihoven a vypnout xap
cp conf.mk-dist conf.mk
+BUILD_XAP ?= no
-BUILD_XAP ?= yes

+LUAJIT ?= /usr/
-LUAJIT ?= /usr/local
 
+SOIL ?= /usr/
-SOIL ?= /usr/local
 
+EXTRA_CXXFLAGS ?= -I/usr/include/SOIL
-EXTRA_CXXFLAGS ?=
  • spustit kompilaci
  • lze použít přímo make, ale lepší je ./mkdisr, který navíc vytváří rovnou výstupní archív s binárkama
  • mkdistr ale ignoruje conf.mk a snaží se buildovat i xap, lze upravit takto
# build x-plane plugin
 cd ../xap
-make clean
-make 
+#make clean
+#make 
  • výsledek je ve složce distr

Řešené problémy

  • obecně jsem postupoval takto
luna.h:10:17: fatal error: lua.h: Adresář nebo soubor neexistuje
 #include <lua.h>
                 ^
$ locate lua.h
  • pak jsem kouknul na web debian, který balíček soubor poskytuje a v jaké cestě
  • další zajímavý problém byl s kompilací lokálních adresářů
  • pokud jsem dal make clean, tak to vyčistilo i složky, které se v mkdistr nebuildují přímo
  • například chyba
make: *** Žádné pravidlo jak vyrobit cíl „../libaccgl/libaccgl.a“ potřebný pro „slava“. Konec.
  • oprava jednoduchá, zavoláním make nebo
make -C libaccgl
  • lze vyřešit i úpravou mkdistr, například pro alsound následovně
--- mkdistr.sh	(revision 224)
+++ mkdistr.sh	(working copy)

+# build alsound
+cd alsound
+make clean
+make
+if [ $? != 0 ] ; then
+    echo "Can't build alsound!"
+    exit -1
+fi
+cd ..

Testování slava-Sasl

  • po zbuildování Slava jsem přišel na to, že s aplikaci nelze spojit Carenado SASL pluginem
  • používají nejspíš verzi s bugem v handshake (jako zde).. chovalo se to následovně
server:
con.send((unsigned char*)"NP1\n", 4);
con.send(seed, 16);

client:
md5_append(&md5, buf.getData(), 20);
md5_append(&md5, (md5_byte_t*)secret, strlen(secret));
md5_byte_t digest[16];
md5_finish(&md5, digest);
con.send(digest, 16);
  
server:
md5_append(&md5, (const md5_byte_t*)"NP2\n", 4);
md5_append(&md5, seed, 16);
md5_append(&md5, (const md5_byte_t*)secret.c_str(), secret.length());
unsigned char digest[16];
  • vymyslel jsem opravu ve tvaru
Index: libavionics/propsclient.cpp
===================================================================
--- libavionics/propsclient.cpp	(revision 224)
+++ libavionics/propsclient.cpp	(working copy)
@@ -601,6 +601,10 @@
 
     md5_state_t md5;
     md5_init(&md5);
+    if (buf.getData()[2]=='1') {
+        props->log.error("I have received NP1... rewriting to NP2 :)");
+        buf.getData()[2]='2';
+    }
     md5_append(&md5, buf.getData(), 20);
     md5_append(&md5, (md5_byte_t*)props->secret.c_str(), 
             props->secret.length());
  • což pomohlo a Slava se se SASL serverem spojila
  • nebylo to ale stabilní. Pokud jsem ve Slava na něco klikl, tak se to nějak rozpojilo

Zprovoznění Sasl u letadel

  • měl jsem letadla, u kterých měl běžet sasl plugin, ale neběžel
  • zjistil jsem, že tam někdy chybí 64 bit verze nebo verze pro Linux
  • dále jsem zjistil, že ldd na lin.xpl má někdy problémy najít knihovny a tak se modul nezavede
  • důvod přeskočení pluginu by to mělo vypsat do x-plane Log.txt

Kompilace SASL

  • odstraněno zakomentování buildu xap (kompilace Slava)
  • přidáno x-plane SDK
  • kompilace proběhla v pohodě, ale x-plane při pokusu načíst letadlo spadne
SASL: Starting...
X-Plane scriptable avionics library plugin v2.0.3
Loaded: /opt/X-Plane 10/Aircraft/General Aviation/Carenado C152II v3 (muj sasl)/plugins/sasl/64/lin.xpl (1-sim.sasl).

SASL: Path to panel: /opt/X-Plane 10/Aircraft/General Aviation/Carenado C152II v3 (muj sasl)/avionics.lua
SASL: Loading avionics...
--=={This application has crashed because of the plugin: SASL}==--
  • do terminálu vypisuje
Got allocator: 0x41e1c010
Must use luaL_newstate() for 64 bit target
Got Lua: (nil)
error creating Lua virtual machine
Neúspěšně ukončen (SIGABRT)
  • je to prý způsobeno nepovolenou custom alokaci v knihovně LuaJIT na 64 bit systémech (info zde)
  • diskuze o problému například zde
  • řešením je nejspíš použití toho [https://gist.github.com/nddrylliog/8722197|patche]] a následně přilinkování do lin.xpl staticky (to je i důvod, proč je carenado lin.xpl 2x větší než můj build)
  • já jsem problém zkoušel vyřešit takto:
vim xap/xplua.cpp
- lua = lua_newstate(lj_alloc_f, ud);
+ lua = luaL_newstate();
  • funguje to, ale nevím jestli je to stabilní :) spíš bych měl zkusit to statické slinkování

Historie

Původní vize autora

http://forums.x-plane.org/index.php?showtopic=38827

Everybody who tried to make own aircraft model discovered that real avionics often can't be simulated by default X-Plane gauges. Generic gauges was a great step to avionics simulation but it lacks most important thing: ability to specify custom logic. For example it is not possible to simulate Boeing FMC with generics and it is not possible to make Tu-16 autopilot AP-5 (I believe it is weirdest autopilot in the world) by using default features.

Some day I decided to solve this problem. Actually there was a lot of more problems those days because of generics doesn't existed yet. My goal was to make technology which will allow:

  1. Simulate virtually any avionics
  2. Avionics should work in 3D cockpit, 2D panels and 2D popup panels
  3. Avionics should work over network (internet) on remote computers to allow creation of complex training devices
  4. Avionics development should to be easy and fast

After few years of development I've finished with SASL toolkit. While it is in active development phase it is already can do everything from list above.

SASL approach to avionics can be described as „components and scripting“. Everything in SASL world consist of 'components'. For example, typical simple gauge consists of 2 components: background texture and needle which can rotate depending on value of variable. Often X-Plane variable is not enough and one can write any function which can describe needle rotation. For example one can add jitter to ADF needle to make it more realistic. Complex gauges can use other gauges as their subcomponents. Components haven't to be visual: one can make some logic as component. For example such component can add few more failures (may be useful for training) or entire autopilot.

Developing new avionics is relative fast. First of all easiest way is to find completed required gauge. While number of aircrafts increasing more and more gauges sees light. If you are no lucky you have to create your own one. It is fast because you haven't recompile your project and wait for X-Plane startup after every change. Just edit gauge description text file, press F8 key and it will be loaded instantly. Properly designed gauge can be copied to another aircraft or launched over network on another computer.

SASL is open source project and can be used in any simulator, not just X-Plane. For now it is employed in following X-Plane models:

  1. Tu-104B (http://code.google.com/p/sasl/): SASL usage example and playground
  2. IL-14 (http://www.store.x-plane.su/): complex payware aircraft by Felis. Has a lot of custom logic and failures
  3. Yak-40 (http://code.google.com/p/yk40/): open source work-in-progress, will be another SASL demonstrator

SASL source codes and snapshot builds available here: http://code.google.com/p/sasl/

You can download Tu-104 example aircraft (just unpack it to your X-Plane directory; everything required is inside of archive; no additional installation steps required). Also you can download stand-alone avionics application (slava) which allows to run gauges over network. Generic soviet stile navigator panel included in slava archive. In order to run it you have to open Tu-104 (or other sasl enabled aircraft) in X-Plane, specify network password in plugins menu and start server. Next you have to edit slava.bat (or slava.sh depending on your OS) end set the same password and X-Plane computer IP address. Run slava.bat (slava.sh) after that and you'll see navigator panel working over network.

For now I'm going to stop adding new features for a while and write documentation for avionics developers. I'm highly very interested in your thoughts about future of this project. Don't hesitate to ask any questions.

Změna GPL na proprietární

http://forums.x-plane.org/index.php?showtopic=90977

Hi guys.

People have asked me to give a short explanation to what is going on with sasl, so here it is. SASL has two types of users: regular users (designers that make planes with sasl) and contributes (people who compile sasl and add functionality). SASL also has two versions: open and commercial (with key protection and/or code scrambling).

As you all know, for the last few years sasl has been stagnating due to lack of development and contribution from 3rd party programmers. About a year ago we have taken over commercial sasl and with it its main free branch. In order to add functionality to the commercial version we much add the same functionality to the open one, otherwise designers won't be able to develop their planes.

In the past SASL was GPL, which meant that you were free to compile your own version but had to make your code open source as well. There were only five such contributors. If you have compiled your version without making your code open source, oh well…. What has changed now is that it is a copyrighted plugin however, its copyright is very open. As regular users you are still free to use the open sasl binaries for whatever projects you like, all that we ask is for you to place the copyright notice in your product to promote our work on sasl, We also urge you to use the commercial sasl for your commercial products, it is safer for your code as it can't be copied by others without permission, it helps keep your product off torrent sites by providing key protection and your small (actually very small) contribution to the project helps us fund future development of sasl.

If you would like to be a contributer to the code, you can find the sources of SASL on gitHub https://github.com/temk/sasl-2.x. If you add code we will review it and if it doesn't conflict with anything we are doing we will accept it and move it to the commercial version also. The code will remain open as it is now. For more info on this please read the licence agreement in the repo.

SASL 3.0 is being developed in parallel with 2.x updates which you see. It is mostly a refactoring project where we will move to fully C++ object oriented code. We also plan many additions and new functionality including the ability to integrate C++ code right into sasl script. If you have suggestions, requests or comments on this please most them on this forum. We will try to accommodate you.

TODO

  • co zkompilovat sasl 2.0.3 a dát ho do Caranado letadel??
    • bude Slava fungovat bez zaseknutí?
    • a letadlo bez problémů (zvuk motoru, menu, pilot, ..)?
  • a kruci.. s tím starým mým buildem je to ok, ale s tím novým to padá ihned :/
  • udělat si vlastní panel s pár přístroji…
    • například pro cesnu 152, přístroje se dají vytahat z textur
  • zkusit namergovat (zkompilovat) Slave se zdrojaky 2.4 a používat tuhle novou verzi :)
  • zapřemýšlet, zda není jednoduší se na Slava vykašlat a udělat si vlastní dílo (nebo jiný projekt)
    • nevýhoda SASL je v tom, že každý letadlo může mít jinou verzi
    • některá letadla mohou používat tu DRM nebo šifrování a tam bych to tou free verzi popsul
xpl_sasl.txt · Poslední úprava: autor: 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki