-{
- "text_map", menu_vis, {.i=k_menu_page_main},
- .fn_press = menu_btn_map,
- .lr="text_reset"
-},
-*/
-{
- "text_settings", menu_vis, {.i=k_menu_page_main|k_menu_page_settings},
- .fn_press = menu_btn_settings,
- .ll="text_reset"
-},
-{
- "skater_left", menu_vis, {k_menu_page_skater}
-},
-{
- "skater_right", menu_vis, {k_menu_page_skater}
-},
-
-{
- "fov_slider", menu_vis, {k_menu_page_settings},
- .ld="text_invert_y"
-},
-{ "fov_info", menu_vis, {k_menu_page_settings} },
-
-{
- "vol_slider", menu_vis, {k_menu_page_settings},
- .lu="res_slider"
-},
-{ "vol_info", menu_vis, {k_menu_page_settings} },
-
-{
- "text_invert_y", menu_vis, {k_menu_page_settings},
- .fn_press = menu_btn_invert_y,
- .lu = "fov_slider", .ld="text_blur"
-},
-{
- "text_invert_y_check", menu_settings_if, {.ptr_generic=&cl_invert_y}
-},
-{
- "text_blur", menu_vis, {k_menu_page_settings},
- .fn_press = menu_btn_blur,
- .lu="text_invert_y", .ld="res_slider"
-},
-{
- "text_blur_check", menu_settings_if, {.ptr_generic=&cl_blur}
-},
-{
- "res_slider", menu_vis, {k_menu_page_settings},
- .ld = "vol_slider", .lu = "text_blur"
-},
-{
- "res_info", menu_vis, {k_menu_page_settings},
-},
-{ "ctr_xbox", menu_controller_inf, {k_menu_controller_type_xbox}},
-{ "ctr_xbox_text", menu_controller_inf, {k_menu_controller_type_xbox}},
-{ "ctr_steam", menu_controller_inf, {k_menu_controller_type_steam}},
-{ "ctr_steam_text", menu_controller_inf, {k_menu_controller_type_steam}},
-{ "ctr_deck", menu_controller_inf, {k_menu_controller_type_steam_deck}},
-{ "ctr_deck_text", menu_controller_inf, {k_menu_controller_type_steam_deck}},
-{ "ctr_ps", menu_controller_inf, {k_menu_controller_type_playstation}},
-{ "ctr_ps_text", menu_controller_inf, {k_menu_controller_type_playstation}},
-{ "ctr_kbm", menu_controller_inf, {k_menu_controller_type_keyboard}},
-{ "ctr_kbm_text", menu_controller_inf, {k_menu_controller_type_keyboard}},
-{
- "text_paused", menu_vis, {k_menu_page_main}
-},
-};
-
-VG_STATIC int menu_get_loc( const char *loc )
-{
- for( int i=0; i<vg_list_size(menu_buttons); i++ )
- if( !strcmp( menu_buttons[i].name, loc ) )
- return i;
-
- assert(0);
- return 0;
-}
+ * Attaches memory locations to the various items in the menu
+ */
+static void menu_link(void){
+ /* link data locations */
+ for( u32 i=0; i<mdl_arrcount(&menu.items); i++ ){
+ ent_menuitem *item = mdl_arritm( &menu.items, i );
+
+ if( item->type == k_ent_menuitem_type_toggle ||
+ item->type == k_ent_menuitem_type_slider ){
+
+ const char *name;
+
+ if( item->type == k_ent_menuitem_type_slider )
+ name = mdl_pstr( &menu.model, item->slider.pstr_data );
+ else
+ name = mdl_pstr( &menu.model, item->checkmark.pstr_data );
+ vg_var *var = vg_console_match_var( name );
+
+ if( var ){
+ if( ( item->type == k_ent_menuitem_type_slider &&
+ var->data_type != k_var_dtype_f32
+ ) ||
+ ( item->type == k_ent_menuitem_type_toggle &&!
+ ( var->data_type == k_var_dtype_i32 ||
+ var->data_type == k_var_dtype_u32
+ )
+ )
+ ){
+ vg_error( "Cannot hook to data %s(%p), because it is type %d.\n",
+ name, var, var->data_type );
+ item->pvoid = NULL;
+ }
+ else{
+ item->pvoid = var->data;
+ }
+ }
+ else{
+ vg_error( "No data named %s\n", name );
+ item->pvoid = NULL;
+ }
+ }
+ else{
+ item->pvoid = NULL;
+ }
+ }