From: Urban Wallasch Date: Tue, 13 Jul 2021 15:20:16 +0000 (+0200) Subject: * Upgraded to SDK version 1_17 (game patch 1.41). X-Git-Tag: v0.2.0^0 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=636cec04fd01c1c4c4a2abaff46493c68b69271c;p=ets2_tele.git * Upgraded to SDK version 1_17 (game patch 1.41). * Added differential lock channel to telemetry. * Added planned job distance configuration to telemetry. * Indicate automatic mode for reverse gears. * Bumped TELE_VERSION to 4. --- diff --git a/dash.html b/dash.html index f4b7d6a..d5d4214 100644 --- 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 { Mass - From - To - + Dist - Reward - @@ -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 + '.-' : '-'; } diff --git a/index.html b/index.html index 580abc5..5db452b 100644 --- a/index.html +++ b/index.html @@ -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 { Mass - From - To - + Dist - Reward - @@ -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) { diff --git a/sdk/include/amtrucks/scssdk_telemetry_ats.h b/sdk/include/amtrucks/scssdk_telemetry_ats.h index 685ebc5..6f6bd23 100644 --- a/sdk/include/amtrucks/scssdk_telemetry_ats.h +++ b/sdk/include/amtrucks/scssdk_telemetry_ats.h @@ -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. diff --git a/sdk/include/common/scssdk_telemetry_common_configs.h b/sdk/include/common/scssdk_telemetry_common_configs.h index 6bafa25..8965752 100644 --- a/sdk/include/common/scssdk_telemetry_common_configs.h +++ b/sdk/include/common/scssdk_telemetry_common_configs.h @@ -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? diff --git a/sdk/include/common/scssdk_telemetry_common_gameplay_events.h b/sdk/include/common/scssdk_telemetry_common_gameplay_events.h index b8a2ff2..9d6f018 100644 --- a/sdk/include/common/scssdk_telemetry_common_gameplay_events.h +++ b/sdk/include/common/scssdk_telemetry_common_gameplay_events.h @@ -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 diff --git a/sdk/include/common/scssdk_telemetry_truck_common_channels.h b/sdk/include/common/scssdk_telemetry_truck_common_channels.h index 1506fa8..d703a6c 100644 --- a/sdk/include/common/scssdk_telemetry_truck_common_channels.h +++ b/sdk/include/common/scssdk_telemetry_truck_common_channels.h @@ -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. /** diff --git a/sdk/include/eurotrucks2/scssdk_telemetry_eut2.h b/sdk/include/eurotrucks2/scssdk_telemetry_eut2.h index 58172f7..9618d26 100644 --- a/sdk/include/eurotrucks2/scssdk_telemetry_eut2.h +++ b/sdk/include/eurotrucks2/scssdk_telemetry_eut2.h @@ -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. diff --git a/tele2json.c b/tele2json.c index f2d011e..19b9315 100644 --- a/tele2json.c +++ b/tele2json.c @@ -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 diff --git a/telemetry.h b/telemetry.h index c856302..c1f83f1 100644 --- a/telemetry.h +++ b/telemetry.h @@ -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 }; diff --git a/teleshmem.cpp b/teleshmem.cpp index ba49a7f..723d1da 100644 --- a/teleshmem.cpp +++ b/teleshmem.cpp @@ -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)