From 9d300a69c1220cbcd0412dd4b486de7020be4e23 Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 29 Aug 2026 11:29:11 +0200 Subject: [PATCH] feat(state): save more data in files --- src/state.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/state.c b/src/state.c index c931749..4549686 100644 --- a/src/state.c +++ b/src/state.c @@ -186,6 +186,35 @@ static void save_to_file(const Context *context, StateConfig state_config, lines.length = 0; + snprintf(lines.values[lines.length++], STR_LEN, "time=%f", context->time); + if (lines.length > ARRAY_SIZE) { + log_error("Too many values to save"); + return; + } + snprintf(lines.values[lines.length++], STR_LEN, "beats=%f", + context->tempo_total); + if (lines.length > ARRAY_SIZE) { + log_error("Too many values to save"); + return; + } + snprintf(lines.values[lines.length++], STR_LEN, "demo=%d", + context->demo ? 1 : 0); + if (lines.length > ARRAY_SIZE) { + log_error("Too many values to save"); + return; + } + snprintf(lines.values[lines.length++], STR_LEN, "auto_random=%d", + context->auto_random ? 1 : 0); + if (lines.length > ARRAY_SIZE) { + log_error("Too many values to save"); + return; + } + snprintf(lines.values[lines.length++], STR_LEN, "auto_random_cycle=%d", + context->auto_random_cycle); + if (lines.length > ARRAY_SIZE) { + log_error("Too many values to save"); + return; + } snprintf(lines.values[lines.length++], STR_LEN, "tempo=%d", (unsigned int)context->tempo.tempo); if (lines.length > ARRAY_SIZE) {