Reproduce with this code:
Code: Select all
#include <cstdio>
#include <cinttypes>
#include "scssdk_telemetry.h"
#include "common/scssdk_telemetry_truck_common_channels.h"
static scs_telemetry_init_params_v100_t params_copy;
static void callback(const scs_string_t name, const scs_u32_t index, const scs_value_t * const value, const scs_context_t context)
{
char buffer[128];
if (value)
std::snprintf(buffer, sizeof buffer, "%s[%" PRIu32 "] = %.9g", name, index, value->value_float.value);
else
std::snprintf(buffer, sizeof buffer, "%s[%" PRIu32 "] = null", name, index);
params_copy.common.log(SCS_LOG_TYPE_message, buffer);
}
SCSAPI_RESULT scs_telemetry_init(const scs_u32_t version, const scs_telemetry_init_params_t * const params)
{
if (version != SCS_TELEMETRY_VERSION_1_00)
return SCS_RESULT_unsupported;
params_copy = *static_cast<const scs_telemetry_init_params_v100_t *>(params);
params_copy.register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_wheel_rotation, 0, SCS_VALUE_TYPE_float, SCS_TELEMETRY_CHANNEL_FLAG_no_value, callback, nullptr);
params_copy.register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_wheel_lift, 0, SCS_VALUE_TYPE_float, SCS_TELEMETRY_CHANNEL_FLAG_no_value, callback, nullptr);
params_copy.register_for_channel(SCS_TELEMETRY_TRUCK_CHANNEL_wheel_lift_offset, 0, SCS_VALUE_TYPE_float, SCS_TELEMETRY_CHANNEL_FLAG_no_value, callback, nullptr);
return SCS_RESULT_ok;
}
SCSAPI_VOID scs_telemetry_shutdown(void)
{
}
Code: Select all
Crashed Thread: 0 MainThrd Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
VM Regions Near 0x20:
-->
__TEXT 00000001052aa000-0000000106396000 [ 16.9M] r-x/rwx SM=COW /Users/USER/Library/Application Support/Steam/*/Euro Truck Simulator 2.app/Contents/MacOS/eurotrucks2
Thread 0 Crashed:: MainThrd Dispatch queue: com.apple.main-thread
0 com.scssoft.ets2 0x000000010591adde 0x1052aa000 + 6753758
1 com.scssoft.ets2 0x00000001058afe9d 0x1052aa000 + 6315677
2 com.scssoft.ets2 0x0000000105f20214 0x1052aa000 + 13066772
3 com.scssoft.ets2 0x0000000105f19800 0x1052aa000 + 13039616
4 com.scssoft.ets2 0x000000010539a2aa 0x1052aa000 + 983722
5 com.scssoft.ets2 0x00000001059e8f1f 0x1052aa000 + 7597855
6 com.scssoft.ets2 0x0000000105d71a45 0x1052aa000 + 11303493
7 com.scssoft.ets2 0x0000000105d66195 0x1052aa000 + 11256213
8 com.scssoft.ets2 0x00000001052ab9b3 0x1052aa000 + 6579
9 libdyld.dylib 0x00007fffbf0ec235 start + 1
Version 1.28.0.15s, 64-bit, on macOS 10.12.6.