* Upgraded to SDK version 1_17 (game patch 1.41). v0.2.0
authorUrban Wallasch <urban.wallasch@freenet.de>
Tue, 13 Jul 2021 15:20:16 +0000 (17:20 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Tue, 13 Jul 2021 15:33:48 +0000 (17:33 +0200)
* Added differential lock channel to telemetry.
* Added planned job distance configuration to telemetry.
* Indicate automatic mode for reverse gears.
* Bumped TELE_VERSION to 4.

dash.html
index.html
sdk/include/amtrucks/scssdk_telemetry_ats.h
sdk/include/common/scssdk_telemetry_common_configs.h
sdk/include/common/scssdk_telemetry_common_gameplay_events.h
sdk/include/common/scssdk_telemetry_truck_common_channels.h
sdk/include/eurotrucks2/scssdk_telemetry_eut2.h
tele2json.c
telemetry.h
teleshmem.cpp

index f4b7d6ad58211f2c3fa926b806281fbe07c47ca6..d5d42142e42fac19bb47ca719446d669436087ff 100644 (file)
--- a/dash.html
+++ b/dash.html
@@ -64,8 +64,8 @@ table { width: 100%; }
 .tinyb { font-size: 1em; font-weight: bold; }
 
 .dim { color:#888; }
-.warn1 { color:#fd0; }
-.warn2 { color:#f20; }
+.warn1 { color:#fd0 !important; }
+.warn2 { color:#f20 !important; }
 .setval { color:#0af; }
 .hilite { background-color: #ff0; }
 .special { font-size:50%; color:#088; }
@@ -176,6 +176,7 @@ x-bar {
     <tr><td class="tiny">Mass&nbsp;</td><td><span class="tinyb" id="cargomass">-</span></td></tr>
     <tr><td class="tiny">From&nbsp;</td><td><span class="tinyb" id="source">-</span></td></tr>
     <tr><td class="tiny">To&nbsp;</td><td><span class="tinyb" id="destination">-</span></td></tr>
+    <tr><td class="tiny">Dist&nbsp;</td><td><span class="tinyb" id="job_dist">-</span></td></tr>
     <tr><td class="tiny">Reward&nbsp;</td><td><span class="tinyb" id="reward">-</span></td></tr>
   </table>
 </x-boxleft>
@@ -221,6 +222,7 @@ var cargo = document.getElementById('cargo');
 var cargomass = document.getElementById('cargomass');
 var source = document.getElementById('source');
 var destination = document.getElementById('destination');
+var job_dist = document.getElementById('job_dist');
 var reward = document.getElementById('reward');
 //
 var errbar = document.getElementById('errbar');
@@ -291,7 +293,7 @@ function dgear(x, f, m) {
   if ( x > 0 )
     return ( m ? '' : 'A' ) + ( f==14 ? ( x<3 ? 'C'+x : x-2 ) : x );
   if ( x < 0 )
-    return 'R' + -x;
+    return ( m ? '' : 'A' ) + 'R' + -x;
   return 'N';
 }
 
@@ -319,7 +321,7 @@ function loadDoc() {
 }
 
 // Version and flag constants:
-const TELE_VERSION = 3;
+const TELE_VERSION = 4;
 const TELE_FLAG_ALIVE = 1;
 const MINUS_1_U32 = 4294967295;   // minus one as 32 bit unsigned int
 
@@ -407,6 +409,8 @@ function update_cb() {
     // engine gear:
     if ( !last_tele || last_tele.gear_disp != tele.gear_disp || last_tele.shifter != tele.shifter )
       gear.innerHTML = dgear(tele.gear_disp, tele.gear_fwdcnt, tele.shifter);
+    if ( !last_tele || last_tele.diff_lock != tele.diff_lock )
+      warn( gear, tele.diff_lock ? 2 : 0 );
     // clutch:
     if ( !last_tele || last_tele.clutch_eff != tele.clutch_eff ) {
       if ( tele.clutch_eff > 0 )
@@ -509,6 +513,7 @@ function update_cb() {
       cargomass.innerHTML = tele.job_isvalid ? (tele.job_cargo_mass / 1000).toFixed(0) + 't' : '-';
       source.innerHTML = tele.job_isvalid ? tele.job_source_city : '-';
       destination.innerHTML = tele.job_isvalid ? tele.job_destination_city : '-';
+      job_dist.innerHTML = tele.job_isvalid ? tele.job_planned_distance + 'km' : '-';
       reward.innerHTML = tele.job_isvalid ? tele.job_income + '.-' : '-';
     }
 
index 580abc5c61745fb226d924378c53a2828c1bea68..5db452b30ed73e5d3bb227892572cba5f15b8660 100644 (file)
@@ -61,8 +61,8 @@ table { width: 100%; }
 .tiny { font-size: 1em; }
 .tinyb { font-size: 1em; font-weight: bold; }
 
-.warn1 { color:#fd0; }
-.warn2 { color:#f20; }
+.warn1 { color:#fd0 !important; }
+.warn2 { color:#f20 !important; }
 .setval { color:#0af; }
 .hilite { background-color: #ff0; }
 .special { font-size:50%; color:#088; }
@@ -141,6 +141,7 @@ x-bar {
     <tr><td class="tiny">Mass&nbsp;</td><td><span class="tinyb" id="cargomass">-</span></td></tr>
     <tr><td class="tiny">From&nbsp;</td><td><span class="tinyb" id="source">-</span></td></tr>
     <tr><td class="tiny">To&nbsp;</td><td><span class="tinyb" id="destination">-</span></td></tr>
+    <tr><td class="tiny">Dist&nbsp;</td><td><span class="tinyb" id="job_dist">-</span></td></tr>
     <tr><td class="tiny">Reward&nbsp;</td><td><span class="tinyb" id="reward">-</span></td></tr>
   </table>
 </x-boxleft>
@@ -180,6 +181,7 @@ var cargo = document.getElementById("cargo");
 var cargomass = document.getElementById("cargomass");
 var source = document.getElementById("source");
 var destination = document.getElementById("destination");
+var job_dist = document.getElementById('job_dist');
 var reward = document.getElementById("reward");
 //
 var errbar = document.getElementById("errbar");
@@ -238,7 +240,7 @@ function dgear(x, f, m) {
   if ( x > 0 )
     return ( m ? '' : 'A' ) + ( f==14 ? ( x<3 ? 'C'+x : x-2 ) : x );
   if ( x < 0 )
-    return 'R' + -x;
+    return ( m ? '' : 'A' ) + 'R' + -x;
   return 'N';
 }
 
@@ -269,7 +271,7 @@ function update_cb() {
       errbar.innerHTML = "Game offline";
       return;
     }
-    else if ( tele.tele_version !== 3 ) {  // TELE_VERSION
+    else if ( tele.tele_version !== 4 ) {  // TELE_VERSION
       errbar.style.display = "block";
       errbar.innerHTML = "Version mismatch";
     } else {
@@ -308,6 +310,7 @@ function update_cb() {
     cctrl.innerHTML = Math.round(tele.cctrl * 3.6);
     // engine gear:
     gear.innerHTML = dgear(tele.gear_disp, tele.gear_fwdcnt, tele.shifter);
+    warn( gear, tele.diff_lock ? 2 : 0 );
     if ( tele.clutch_eff > 0 )
       gear.classList.add("hilite");
     else
@@ -378,6 +381,7 @@ function update_cb() {
     cargomass.innerHTML = tele.job_isvalid ? (tele.job_cargo_mass / 1000).toFixed(0) + 't' : '-';
     source.innerHTML = tele.job_isvalid ? tele.job_source_city : '-';
     destination.innerHTML = tele.job_isvalid ? tele.job_destination_city : '-';
+    job_dist.innerHTML = tele.job_isvalid ? tele.job_planned_distance + 'km' : '-';
     reward.innerHTML = tele.job_isvalid ? tele.job_income + '.-' : '-';
   }
   else if (this.readyState == 4) {
index 685ebc5609dd5ebe3d584b2af028a0368da5823e..6f6bd23df22875efb543f809fbff24b0bb7df618 100644 (file)
@@ -29,11 +29,17 @@ SCSSDK_HEADER
  * 1.00 - initial version - corresponds to 1.12 in ETS2
  * 1.01 - added support for multiple trailers (doubles, triples), trailer ownership support,
  *        gameplay events support added
+ * 1.02 - added planned_distance_km to active job info
+ * 1.03 - added support for 'avoid_inspection', 'illegal_border_crossing' and 'hard_shoulder_violation' offence type in 'player.fined' gameplay event
+ * 1.04 - added differential lock, lift axle and hazard warning channels
  */
 //@{
 #define SCS_TELEMETRY_ATS_GAME_VERSION_1_00             SCS_MAKE_VERSION(1, 0)
 #define SCS_TELEMETRY_ATS_GAME_VERSION_1_01             SCS_MAKE_VERSION(1, 1)
-#define SCS_TELEMETRY_ATS_GAME_VERSION_CURRENT          SCS_TELEMETRY_ATS_GAME_VERSION_1_01
+#define SCS_TELEMETRY_ATS_GAME_VERSION_1_02             SCS_MAKE_VERSION(1, 2) // Patch 1.36
+#define SCS_TELEMETRY_ATS_GAME_VERSION_1_03             SCS_MAKE_VERSION(1, 3) // Patch 1.36
+#define SCS_TELEMETRY_ATS_GAME_VERSION_1_04             SCS_MAKE_VERSION(1, 4) // Patch 1.41
+#define SCS_TELEMETRY_ATS_GAME_VERSION_CURRENT          SCS_TELEMETRY_ATS_GAME_VERSION_1_04
 //@}
 
 // Game specific units.
index 6bafa250cb0e766a1fb74702250a68f7ba75367c..89657525f9fab756ad07b431fd0bd637a10a0e83 100644 (file)
@@ -100,7 +100,7 @@ SCSSDK_HEADER
  *
  * If there are less trailers in game than @c SCS_TELEMETRY_trailers_count
  * telemetry will return all configurations however starting from the trailer after last
- * existing one its attributes will be empty. (only one unnamed attribute will be returned)
+ * existing one its attributes will be empty.
  *
  * Supported attributes:
  * @li id
@@ -109,8 +109,8 @@ SCSSDK_HEADER
  * @li brand_id
  * @li brand
  * @li name
- * @li chain_type
- * @li body_type
+ * @li chain_type (reported only for first trailer)
+ * @li body_type (reported only for first trailer)
  * @li license_plate
  * @li license_plate_country
  * @li license_plate_country_id
@@ -141,6 +141,7 @@ SCSSDK_HEADER
  * @li is_cargo_loaded
  * @li job_market
  * @li special_job
+ * @li planned_distance_km
  */
 #define SCS_TELEMETRY_CONFIG_job                                "job"
 
@@ -606,6 +607,14 @@ SCSSDK_HEADER
  */
 #define SCS_TELEMETRY_CONFIG_ATTRIBUTE_delivery_time            "delivery.time"
 
+/**
+ * @brief Planned job distance in simulated kilometers.
+ *
+ * Does not include distance driven using ferry.
+ *
+ * Type: u32
+ */
+#define SCS_TELEMETRY_CONFIG_ATTRIBUTE_planned_distance_km     "planned_distance.km"
 
 /**
  * @brief Is cargo loaded on the trailer?
index b8a2ff22acee054b044a4ed91116ed74e45e5ea0..9d6f018af7923d8bb1cbca348ebedd4bb1dbea83 100644 (file)
@@ -144,6 +144,10 @@ SCSSDK_HEADER
  * @li speeding
  * @li avoid_weighing
  * @li illegal_trailer
+ * @li avoid_inspection
+ * @li illegal_border_crossing
+ * @li hard_shoulder_violation
+ * @li damaged_vehicle_usage
  * @li generic
  *
  * Type: string
index 1506fa8184f8b869cbd0312c0bb7b82e19197a88..d703a6c09c02f700b21266b3381e1443e738b259 100644 (file)
@@ -462,6 +462,17 @@ SCSSDK_HEADER
  */
 #define SCS_TELEMETRY_TRUCK_CHANNEL_rblinker                    "truck.rblinker"
 
+/**
+ * @brief Are the hazard warning light enabled?
+ *
+ * This represents the logical enable state of the hazard warning.
+ * It it is true as long it is enabled regardless of the physical
+ * enabled state of the light (i.e. it does not blink).
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_hazard_warning              "truck.hazard.warning"
+
 /**
  * @brief Is the light in the left blinker currently on?
  *
@@ -554,6 +565,41 @@ SCSSDK_HEADER
  */
 #define SCS_TELEMETRY_TRUCK_CHANNEL_dashboard_backlight         "truck.dashboard.backlight"
 
+/**
+ * @brief Is the differential lock enabled?
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_differential_lock           "truck.differential_lock"
+
+/**
+ * @brief Is the lift axle control set to lifted state?
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_lift_axle                   "truck.lift_axle"
+
+/**
+ * @brief Is the lift axle indicator lit?
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_lift_axle_indicator         "truck.lift_axle.indicator"
+
+/**
+ * @brief Is the trailer lift axle control set to lifted state?
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_trailer_lift_axle           "truck.trailer.lift_axle"
+
+/**
+ * @brief Is the trailer lift axle indicator lit?
+ *
+ * Type: bool
+ */
+#define SCS_TELEMETRY_TRUCK_CHANNEL_trailer_lift_axle_indicator "truck.trailer.lift_axle.indicator"
+
 // Wear info.
 
 /**
index 58172f72d1151eded48b8d4c730c44bcf67d021a..9618d26b1a8e94bfa52c52ac74b718ee7ad95340 100644 (file)
@@ -50,6 +50,9 @@ SCSSDK_HEADER
  *        by ETS2 1.24 and older.
  * 1.14 - added support for multiple trailers (doubles, triples), trailer ownership support,
  *        gameplay events support added
+ * 1.15 - added planned_distance_km to active job info
+ * 1.16 - added support for 'avoid_inspection', 'illegal_border_crossing' and 'hard_shoulder_violation' offence type in 'player.fined' gameplay event
+ * 1.17 - added differential lock, lift axle and hazard warning channels
  */
 //@{
 #define SCS_TELEMETRY_EUT2_GAME_VERSION_1_00            SCS_MAKE_VERSION(1, 0)
@@ -67,7 +70,10 @@ SCSSDK_HEADER
 #define SCS_TELEMETRY_EUT2_GAME_VERSION_1_12            SCS_MAKE_VERSION(1, 12) // Patch 1.17
 #define SCS_TELEMETRY_EUT2_GAME_VERSION_1_13            SCS_MAKE_VERSION(1, 13) // Patch 1.27
 #define SCS_TELEMETRY_EUT2_GAME_VERSION_1_14            SCS_MAKE_VERSION(1, 14) // Patch 1.35
-#define SCS_TELEMETRY_EUT2_GAME_VERSION_CURRENT         SCS_TELEMETRY_EUT2_GAME_VERSION_1_14
+#define SCS_TELEMETRY_EUT2_GAME_VERSION_1_15            SCS_MAKE_VERSION(1, 15) // Patch 1.36
+#define SCS_TELEMETRY_EUT2_GAME_VERSION_1_16            SCS_MAKE_VERSION(1, 16) // Patch 1.36
+#define SCS_TELEMETRY_EUT2_GAME_VERSION_1_17            SCS_MAKE_VERSION(1, 17) // Patch 1.41
+#define SCS_TELEMETRY_EUT2_GAME_VERSION_CURRENT         SCS_TELEMETRY_EUT2_GAME_VERSION_1_17
 //@}
 
 // Game specific units.
index f2d011e6abae2ec0e493083f2310e748cab7d66d..19b9315bffd466511d7a96a3d766ca09f0370104 100644 (file)
@@ -48,6 +48,7 @@ size_t tele2json( char *buf, size_t size, const struct telemetry_state_t *tele )
     n += snprintf( buf+n, size-n, "  \"clutch_eff\": %.12f,\n", tele->clutch_eff ); CHKSIZE;
     n += snprintf( buf+n, size-n, "  \"throttle_eff\": %.12f,\n", tele->throttle_eff ); CHKSIZE;
     n += snprintf( buf+n, size-n, "  \"shifter\": %"PRIi32",\n", tele->shifter ); CHKSIZE;
+    n += snprintf( buf+n, size-n, "  \"diff_lock\": %"PRIu8",\n", tele->diff_lock ); CHKSIZE;
 
     n += snprintf( buf+n, size-n, "  \"fuel\": %.12f,\n", tele->fuel ); CHKSIZE;
     n += snprintf( buf+n, size-n, "  \"fuel_warn\": %"PRIu8",\n", tele->fuel_warn ); CHKSIZE;
@@ -72,6 +73,7 @@ size_t tele2json( char *buf, size_t size, const struct telemetry_state_t *tele )
     n += snprintf( buf+n, size-n, "  \"job_cargo\": \"%s\",\n", tele->job_cargo ); CHKSIZE;
     n += snprintf( buf+n, size-n, "  \"job_source_city\": \"%s\",\n", tele->job_source_city ); CHKSIZE;
     n += snprintf( buf+n, size-n, "  \"job_destination_city\": \"%s\",\n", tele->job_destination_city ); CHKSIZE;
+    n += snprintf( buf+n, size-n, "  \"job_planned_distance\": %"PRIu32",\n", tele->job_planned_distance ); CHKSIZE;
 
     // add more here
 
index c856302d824846e01545e06bc6b47b6d64c4efd2..c1f83f1e7c5ad94d329bb204a8f270af6f30b1ff 100644 (file)
@@ -10,7 +10,7 @@
 
 #define TELE_STRLEN     30
 
-#define TELE_VERSION    3
+#define TELE_VERSION    4
 
 #define TELE_FLAG_ALIVE 0x0001U
 
@@ -52,6 +52,7 @@ struct telemetry_state_t {
     double   clutch_eff; // effective clutch
     double   throttle_eff; // effective throttle
     int32_t  shifter;    // 0 = automatic, 1 = manual
+    bool_t   diff_lock;  // differential lock
 
     double   fuel;       // fuel amount in l
     bool_t   fuel_warn;  // fuel low warning
@@ -75,6 +76,7 @@ struct telemetry_state_t {
     char     job_cargo[TELE_STRLEN];    // job cargo name
     char     job_source_city[TELE_STRLEN];    // job source city name
     char     job_destination_city[TELE_STRLEN];    // job destination city name
+    uint32_t job_planned_distance; // job planned distance in km
 
     uint32_t trailer_cnt; // number of active trailers
 };
index ba49a7fbee00812f739889c8a1b39deeb06784f1..723d1da991dd84b407c66a195bec03190281c61d 100644 (file)
@@ -396,6 +396,7 @@ SCSAPI_VOID telemetry_configuration(const scs_event_t event, const void *const e
         * @li is_cargo_loaded
         * @li job_market
         * @li special_job
+        * @li planned_distance_km
         */
         for (const scs_named_value_t *current = info->attributes; current->name; ++current) {
             if ( 0 == strcmp( current->name, SCS_TELEMETRY_CONFIG_ATTRIBUTE_delivery_time ) ) {
@@ -417,6 +418,9 @@ SCSAPI_VOID telemetry_configuration(const scs_event_t event, const void *const e
             else if ( 0 == strcmp( current->name, SCS_TELEMETRY_CONFIG_ATTRIBUTE_destination_city ) ) {
                 snprintf( telemetry->job_destination_city, sizeof telemetry->job_destination_city, "%s", current->value.value_string.value );
             }
+            else if ( 0 == strcmp( current->name, SCS_TELEMETRY_CONFIG_ATTRIBUTE_planned_distance_km ) ) {
+                telemetry->job_planned_distance = current->value.value_u32.value;
+            }
         }
     }
     else if ( 0 == strcmp( info->id, SCS_TELEMETRY_CONFIG_trailer ) )
@@ -630,6 +634,7 @@ SCSAPI_RESULT scs_telemetry_init(const scs_u32_t version, const scs_telemetry_in
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_engine_rpm, SCS_U32_NIL, SCS_VALUE_TYPE_double, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_double, &telemetry->rpm) == SCS_RESULT_ok)
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_engine_gear, SCS_U32_NIL, SCS_VALUE_TYPE_s32, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_s32, &telemetry->gear) == SCS_RESULT_ok)
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_displayed_gear, SCS_U32_NIL, SCS_VALUE_TYPE_s32, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_s32, &telemetry->gear_disp) == SCS_RESULT_ok)
+        && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_differential_lock, SCS_U32_NIL, SCS_VALUE_TYPE_bool, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_bool, &telemetry->diff_lock) == SCS_RESULT_ok)
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_effective_clutch, SCS_U32_NIL, SCS_VALUE_TYPE_double, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_double, &telemetry->clutch_eff) == SCS_RESULT_ok)
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_effective_throttle, SCS_U32_NIL, SCS_VALUE_TYPE_double, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_double, &telemetry->throttle_eff) == SCS_RESULT_ok)
         && (version_params->register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_fuel, SCS_U32_NIL, SCS_VALUE_TYPE_double, SCS_TELEMETRY_CHANNEL_FLAG_none, telemetry_store_double, &telemetry->fuel) == SCS_RESULT_ok)