diff --git a/capi/bind_gen/src/typescript.ts b/capi/bind_gen/src/typescript.ts index d2c9f77a..c3e2cd29 100644 --- a/capi/bind_gen/src/typescript.ts +++ b/capi/bind_gen/src/typescript.ts @@ -658,11 +658,41 @@ export interface RunMetadataJson { */ region_name: string, /** - * Stores all the variables. A variable is an arbitrary key value pair - * storing additional information about the category. An example of this - * may be whether Amiibos are used in this category. + * Stores all the speedrun.com variables. A variable is an arbitrary key + * value pair storing additional information about the category. An example + * of this may be whether Amiibos are used in this category. */ - variables: { [key: string]: string }, + speedrun_com_variables: { [key: string]: string | undefined }, + /** + * Stores all the custom variables. A custom variable is a key value pair + * storing additional information about a run. Unlike the speedrun.com + * variables, these can be fully custom and don't need to correspond to + * anything on speedrun.com. Permanent custom variables can be specified by + * the runner. Additionally auto splitters or other sources may provide + * temporary custom variables that are not stored in the splits files. + */ + custom_variables: { [key: string]: CustomVariableJson | undefined }, +} +/** + * A custom variable is a key value pair storing additional information about a + * run. Unlike the speedrun.com variables, these can be fully custom and don't + * need to correspond to anything on speedrun.com. Permanent custom variables + * can be specified by the runner. Additionally auto splitters or other sources + * may provide temporary custom variables that are not stored in the splits + * files. + */ +export interface CustomVariableJson { + /** + * The current value of the custom variable. This may be provided by the + * runner in the run editor or it may be provided through other means such + * as an auto splitter. + */ + value: string, + /** + * States whether the variable is permanent. Temporary variables don't get + * stored in splits files. They also don't get shown in the run editor. + */ + is_permanent: boolean, } /** diff --git a/capi/src/lib.rs b/capi/src/lib.rs index 8d0e4d1d..ed069d38 100644 --- a/capi/src/lib.rs +++ b/capi/src/lib.rs @@ -37,8 +37,10 @@ pub mod previous_segment_component; pub mod run; pub mod run_editor; pub mod run_metadata; -pub mod run_metadata_variable; -pub mod run_metadata_variables_iter; +pub mod run_metadata_custom_variable; +pub mod run_metadata_custom_variables_iter; +pub mod run_metadata_speedrun_com_variable; +pub mod run_metadata_speedrun_com_variables_iter; pub mod segment; pub mod segment_history; pub mod segment_history_element; @@ -64,7 +66,8 @@ pub mod title_component; pub mod title_component_state; pub mod total_playtime_component; -use crate::run_metadata_variable::RunMetadataVariable; +use crate::run_metadata_custom_variable::RunMetadataCustomVariable; +use crate::run_metadata_speedrun_com_variable::RunMetadataSpeedrunComVariable; use crate::segment_history_element::SegmentHistoryElement; use livesplit_core::{Time, TimeSpan}; @@ -78,7 +81,8 @@ thread_local! { static TIME_SPAN: Cell = Cell::default(); static TIME: Cell