| 1 | #ifndef CONF_H |
|---|
| 2 | #define CONF_H |
|---|
| 3 | |
|---|
| 4 | #include "gui.h" |
|---|
| 5 | #include "script.h" |
|---|
| 6 | |
|---|
| 7 | #define USER_MENU_ITEMS 14 |
|---|
| 8 | #define CONF_STR_LEN 100 |
|---|
| 9 | |
|---|
| 10 | #define CONF_EMPTY 0 |
|---|
| 11 | // regular char-int-short value |
|---|
| 12 | #define CONF_VALUE 1 |
|---|
| 13 | #define CONF_DEF_VALUE 1 |
|---|
| 14 | // pointer to value |
|---|
| 15 | #define CONF_VALUE_PTR 2 |
|---|
| 16 | // pointer to array of int |
|---|
| 17 | #define CONF_INT_PTR 3 |
|---|
| 18 | // pointer to the string |
|---|
| 19 | #define CONF_CHAR_PTR 4 |
|---|
| 20 | // OSD_pos |
|---|
| 21 | #define CONF_OSD_POS 5 |
|---|
| 22 | |
|---|
| 23 | // Name of default symbol file (for reset) |
|---|
| 24 | #define DEFAULT_SYMBOL_FILE "A/CHDK/SYMBOLS/icon_10.rbf" |
|---|
| 25 | |
|---|
| 26 | typedef struct { |
|---|
| 27 | unsigned short x, y; |
|---|
| 28 | } OSD_pos; |
|---|
| 29 | |
|---|
| 30 | typedef struct { |
|---|
| 31 | int isNumb, isStr, isPInt, isPos; |
|---|
| 32 | int numb; |
|---|
| 33 | char* str; |
|---|
| 34 | int* pInt; |
|---|
| 35 | OSD_pos pos; |
|---|
| 36 | } tConfigVal; |
|---|
| 37 | |
|---|
| 38 | // Please try do not change existed structure, because this will broke modules compatibility |
|---|
| 39 | // If add field to the end of structure minor api version should be increased. |
|---|
| 40 | // If any other change (remove something, change order, add not to the end, change meaning), major api version should be increased |
|---|
| 41 | typedef struct { |
|---|
| 42 | int api_version; // version of this structure |
|---|
| 43 | |
|---|
| 44 | int save_raw; |
|---|
| 45 | int save_raw_in_video; |
|---|
| 46 | int save_raw_in_sports; |
|---|
| 47 | int save_raw_in_burst; |
|---|
| 48 | int save_raw_in_edgeoverlay; |
|---|
| 49 | int save_raw_in_auto; |
|---|
| 50 | int save_raw_in_ev_bracketing; |
|---|
| 51 | int save_raw_in_timer; |
|---|
| 52 | int raw_exceptions_warn; |
|---|
| 53 | int raw_in_dir; |
|---|
| 54 | int raw_prefix; |
|---|
| 55 | int raw_ext; |
|---|
| 56 | int raw_save_first_only; //for series shooting |
|---|
| 57 | int raw_nr; |
|---|
| 58 | int sub_batch_prefix; // output of batch subtracts |
|---|
| 59 | int sub_batch_ext; |
|---|
| 60 | int raw_cache; |
|---|
| 61 | int dng_raw; |
|---|
| 62 | int dng_version; // User selectable DNG version (0=1.3, 1=1.1) - select 1.1 for CHDK to do bad pixel removal (requires creation of badpixel.bin) |
|---|
| 63 | int raw_timer; |
|---|
| 64 | int raw_dng_ext; |
|---|
| 65 | int dng_usb_ext; |
|---|
| 66 | |
|---|
| 67 | int show_osd; |
|---|
| 68 | int hide_osd; |
|---|
| 69 | int show_osd_in_review; |
|---|
| 70 | int script_shoot_delay; |
|---|
| 71 | int show_histo; |
|---|
| 72 | int script_vars[SCRIPT_NUM_PARAMS]; |
|---|
| 73 | char script_file[CONF_STR_LEN]; |
|---|
| 74 | |
|---|
| 75 | int show_dof; |
|---|
| 76 | int batt_volts_max; |
|---|
| 77 | int batt_volts_min; |
|---|
| 78 | int batt_step_25; |
|---|
| 79 | int batt_perc_show; |
|---|
| 80 | int batt_volts_show; |
|---|
| 81 | int batt_icon_show; |
|---|
| 82 | int space_bar_show; |
|---|
| 83 | int space_bar_size; |
|---|
| 84 | int space_bar_width; |
|---|
| 85 | int space_icon_show; |
|---|
| 86 | int show_clock; |
|---|
| 87 | int show_temp; |
|---|
| 88 | int temperature_unit; |
|---|
| 89 | int clock_format; |
|---|
| 90 | int clock_indicator; |
|---|
| 91 | int clock_halfpress; |
|---|
| 92 | int space_perc_show; |
|---|
| 93 | int space_mb_show; |
|---|
| 94 | int show_partition_nr; |
|---|
| 95 | int space_perc_warn; |
|---|
| 96 | int space_mb_warn; |
|---|
| 97 | int space_warn_type; |
|---|
| 98 | int show_movie_time; |
|---|
| 99 | int show_movie_refresh; |
|---|
| 100 | |
|---|
| 101 | int zoom_value; |
|---|
| 102 | |
|---|
| 103 | int show_state; |
|---|
| 104 | int show_remaining_raw; |
|---|
| 105 | int remaining_raw_treshold; |
|---|
| 106 | int show_raw_state; |
|---|
| 107 | int show_values; |
|---|
| 108 | int show_values_in_video; |
|---|
| 109 | int show_overexp; |
|---|
| 110 | |
|---|
| 111 | int histo_mode; |
|---|
| 112 | int histo_auto_ajust; |
|---|
| 113 | int histo_ignore_boundary; |
|---|
| 114 | int histo_layout; |
|---|
| 115 | int histo_show_ev_grid; |
|---|
| 116 | |
|---|
| 117 | int zebra_draw; |
|---|
| 118 | //int zebra_mode; |
|---|
| 119 | //int zebra_restore_screen; |
|---|
| 120 | //int zebra_restore_osd; |
|---|
| 121 | //int zebra_over; |
|---|
| 122 | //int zebra_under; |
|---|
| 123 | //int zebra_draw_osd; |
|---|
| 124 | //int zebra_multichannel; |
|---|
| 125 | |
|---|
| 126 | OSD_pos histo_pos; |
|---|
| 127 | OSD_pos dof_pos; |
|---|
| 128 | OSD_pos batt_icon_pos; |
|---|
| 129 | OSD_pos space_icon_pos; |
|---|
| 130 | OSD_pos space_hor_pos; |
|---|
| 131 | OSD_pos space_ver_pos; |
|---|
| 132 | OSD_pos batt_txt_pos; |
|---|
| 133 | OSD_pos space_txt_pos; |
|---|
| 134 | OSD_pos mode_state_pos; |
|---|
| 135 | OSD_pos mode_raw_pos; |
|---|
| 136 | OSD_pos values_pos; |
|---|
| 137 | OSD_pos clock_pos; |
|---|
| 138 | OSD_pos mode_video_pos; |
|---|
| 139 | OSD_pos mode_ev_pos; |
|---|
| 140 | OSD_pos temp_pos; |
|---|
| 141 | OSD_pos ev_video_pos; |
|---|
| 142 | OSD_pos usb_info_pos; |
|---|
| 143 | |
|---|
| 144 | color histo_color; |
|---|
| 145 | color histo_color2; // markers/border |
|---|
| 146 | color osd_color; |
|---|
| 147 | color osd_color_warn; |
|---|
| 148 | // color batt_icon_color; |
|---|
| 149 | color space_color; |
|---|
| 150 | color menu_color; |
|---|
| 151 | color menu_title_color; |
|---|
| 152 | color menu_cursor_color; |
|---|
| 153 | color menu_symbol_color; |
|---|
| 154 | int menu_center; |
|---|
| 155 | int menu_select_first_entry; |
|---|
| 156 | int menu_symbol_enable; |
|---|
| 157 | //color reader_color; |
|---|
| 158 | //color zebra_color; // under/over |
|---|
| 159 | //color grid_color; |
|---|
| 160 | color osd_color_override; |
|---|
| 161 | |
|---|
| 162 | int font_cp; |
|---|
| 163 | char menu_rbf_file[CONF_STR_LEN]; |
|---|
| 164 | char menu_symbol_rbf_file[CONF_STR_LEN]; |
|---|
| 165 | |
|---|
| 166 | char lang_file[CONF_STR_LEN]; |
|---|
| 167 | |
|---|
| 168 | //char reader_file[CONF_STR_LEN]; |
|---|
| 169 | //int reader_pos; |
|---|
| 170 | //int reader_autoscroll; |
|---|
| 171 | //int reader_autoscroll_delay; |
|---|
| 172 | //char reader_rbf_file[100]; |
|---|
| 173 | //int reader_codepage; |
|---|
| 174 | //int reader_wrap_by_words; |
|---|
| 175 | |
|---|
| 176 | //int sokoban_level; |
|---|
| 177 | |
|---|
| 178 | int flashlight; |
|---|
| 179 | int fast_ev; |
|---|
| 180 | int fast_ev_step; |
|---|
| 181 | int fast_image_quality; |
|---|
| 182 | int fast_movie_control; |
|---|
| 183 | int fast_movie_quality_control; |
|---|
| 184 | int splash_show; |
|---|
| 185 | int start_sound; |
|---|
| 186 | int platformid; |
|---|
| 187 | |
|---|
| 188 | int use_zoom_mf; |
|---|
| 189 | long alt_mode_button; //for S-series |
|---|
| 190 | int alt_prevent_shutdown; |
|---|
| 191 | |
|---|
| 192 | int show_grid_lines; |
|---|
| 193 | //char grid_lines_file[CONF_STR_LEN]; |
|---|
| 194 | //int grid_force_color; |
|---|
| 195 | |
|---|
| 196 | int video_mode; |
|---|
| 197 | int video_quality; |
|---|
| 198 | int video_bitrate; |
|---|
| 199 | |
|---|
| 200 | int tv_bracket_value; |
|---|
| 201 | int av_bracket_value; |
|---|
| 202 | int iso_bracket_value; |
|---|
| 203 | int iso_bracket_koef; |
|---|
| 204 | int subj_dist_bracket_value; |
|---|
| 205 | int subj_dist_bracket_koef; |
|---|
| 206 | int bracket_type; |
|---|
| 207 | int bracketing_add_raw_suffix; |
|---|
| 208 | int clear_bracket; |
|---|
| 209 | int clear_video; |
|---|
| 210 | int override_disable; |
|---|
| 211 | int override_disable_all; |
|---|
| 212 | |
|---|
| 213 | int tv_override_value; |
|---|
| 214 | int tv_override_koef; |
|---|
| 215 | int tv_enum_type; |
|---|
| 216 | int av_override_value; |
|---|
| 217 | |
|---|
| 218 | int nd_filter_state; |
|---|
| 219 | |
|---|
| 220 | int iso_override_value; |
|---|
| 221 | int iso_override_koef; |
|---|
| 222 | // int zoom_override_value; |
|---|
| 223 | // int zoom_override; |
|---|
| 224 | int subj_dist_override_value; |
|---|
| 225 | int subj_dist_override_koef; |
|---|
| 226 | int clear_override; |
|---|
| 227 | // int clear_zoom_override; |
|---|
| 228 | |
|---|
| 229 | int autoiso_enable; |
|---|
| 230 | // int autoiso_shutter; |
|---|
| 231 | int autoiso_shutter_enum; |
|---|
| 232 | int autoiso_user_factor; |
|---|
| 233 | int autoiso_is_factor; |
|---|
| 234 | int autoiso_max_iso_hi; |
|---|
| 235 | int autoiso_max_iso_auto; |
|---|
| 236 | int autoiso_min_iso; |
|---|
| 237 | int autoiso2_shutter_enum; |
|---|
| 238 | int autoiso2_max_iso_auto; |
|---|
| 239 | //AutoISO2 precalced values |
|---|
| 240 | float autoiso2_coef; // C2=( iso2_max_auto_real - iso_max_auto_real) / ( tv_num[autoiso_shutter] - tv_numerator[autoiso2_shutter]) |
|---|
| 241 | int autoiso_max_iso_hi_real; // converted from GUI (possible marketing) to real iso value |
|---|
| 242 | int autoiso_max_iso_auto_real; |
|---|
| 243 | int autoiso_min_iso_real; |
|---|
| 244 | int autoiso2_max_iso_auto_real; |
|---|
| 245 | int autoiso_min_shutter_numerator; // converted from enum to numerator |
|---|
| 246 | int autoiso2_min_shutter_numerator; |
|---|
| 247 | int autoiso2_over; |
|---|
| 248 | |
|---|
| 249 | int overexp_threshold; |
|---|
| 250 | int overexp_ev_enum; // 0-off, 1=-1/3, .. |
|---|
| 251 | |
|---|
| 252 | int dof_subj_dist_as_near_limit; |
|---|
| 253 | int dof_use_exif_subj_dist; |
|---|
| 254 | int dof_subj_dist_in_misc; |
|---|
| 255 | int dof_near_limit_in_misc; |
|---|
| 256 | int dof_far_limit_in_misc; |
|---|
| 257 | int dof_hyperfocal_in_misc; |
|---|
| 258 | int dof_depth_in_misc; |
|---|
| 259 | // int dof_dist_from_lens; |
|---|
| 260 | |
|---|
| 261 | int values_show_in_review; |
|---|
| 262 | int values_show_zoom; |
|---|
| 263 | int values_show_real_aperture; |
|---|
| 264 | int values_show_real_iso; |
|---|
| 265 | int values_show_market_iso; |
|---|
| 266 | int values_show_iso_only_in_autoiso_mode; |
|---|
| 267 | int values_show_ev_seted; |
|---|
| 268 | int values_show_ev_measured; |
|---|
| 269 | int values_show_bv_measured; |
|---|
| 270 | int values_show_bv_seted; |
|---|
| 271 | int values_show_overexposure; |
|---|
| 272 | int values_show_canon_overexposure; |
|---|
| 273 | int values_show_luminance; |
|---|
| 274 | |
|---|
| 275 | int debug_shortcut_action; // 0=none, 1=dump, 2=page display |
|---|
| 276 | int debug_display; // 0=none, 1=props, 2=flash param, 3=tasks |
|---|
| 277 | int debug_propcase_page; // save propcase page |
|---|
| 278 | int debug_lua_restart_on_error; // 0=no, 1=yes |
|---|
| 279 | int debug_misc_vals_show; // 0=no, 1=yes |
|---|
| 280 | |
|---|
| 281 | int script_startup; // remote autostart |
|---|
| 282 | int remote_enable; // remote enable |
|---|
| 283 | int user_menu_enable; |
|---|
| 284 | int user_menu_vars[USER_MENU_ITEMS]; |
|---|
| 285 | int user_menu_as_root; |
|---|
| 286 | int zoom_scale; |
|---|
| 287 | int unlock_optical_zoom_for_video; |
|---|
| 288 | int mute_on_zoom; |
|---|
| 289 | int bad_pixel_removal; |
|---|
| 290 | int video_af_key; |
|---|
| 291 | |
|---|
| 292 | char curve_file[CONF_STR_LEN]; |
|---|
| 293 | int curve_enable; |
|---|
| 294 | |
|---|
| 295 | int edge_overlay_enable; |
|---|
| 296 | //int edge_overlay_filter; |
|---|
| 297 | int edge_overlay_thresh; |
|---|
| 298 | //int edge_overlay_zoom; // shall zoom be set when *edg file is loaded? |
|---|
| 299 | int edge_overlay_pano; // whether a full press changes back to live mode |
|---|
| 300 | //int edge_overlay_pano_overlap; // overlap in % in pano mode |
|---|
| 301 | //int edge_overlay_show; // whether to show overlay even when no button is pressed |
|---|
| 302 | //int edge_overlay_play; // whether edge overlay is switched on also for play mode |
|---|
| 303 | //color edge_overlay_color; |
|---|
| 304 | |
|---|
| 305 | int synch_enable; |
|---|
| 306 | int ricoh_ca1_mode; |
|---|
| 307 | int synch_delay_enable; |
|---|
| 308 | int synch_delay_value; |
|---|
| 309 | int synch_delay_coarse_value; // obsolete - no longer used |
|---|
| 310 | int remote_zoom_enable; |
|---|
| 311 | int zoom_timeout; |
|---|
| 312 | |
|---|
| 313 | int script_param_set; |
|---|
| 314 | int script_param_save; |
|---|
| 315 | |
|---|
| 316 | long mem_view_addr_init; |
|---|
| 317 | int flash_sync_curtain; |
|---|
| 318 | int flash_video_override; |
|---|
| 319 | int flash_manual_override; |
|---|
| 320 | int flash_video_override_power; |
|---|
| 321 | |
|---|
| 322 | // Overrides to disable touchscreen U/I components (IXUS 310) |
|---|
| 323 | int touchscreen_disable_video_controls; |
|---|
| 324 | int touchscreen_disable_shortcut_controls; |
|---|
| 325 | |
|---|
| 326 | // Enable USB icon |
|---|
| 327 | int usb_info_enable; |
|---|
| 328 | |
|---|
| 329 | // gen 2 USB remote |
|---|
| 330 | int remote_switch_type; |
|---|
| 331 | int remote_control_mode; |
|---|
| 332 | |
|---|
| 333 | int ext_video_time; |
|---|
| 334 | |
|---|
| 335 | int remote_enable_scripts; // usb remote activates scripts in <ALT> mode |
|---|
| 336 | |
|---|
| 337 | #if defined(CAM_ZOOM_ASSIST_BUTTON_CONTROL) |
|---|
| 338 | int zoom_assist_button_disable; // used to disable the zoom assist button on SX30 & SX40 for people who keep accidentaly pressing it |
|---|
| 339 | #endif |
|---|
| 340 | |
|---|
| 341 | #ifdef CAM_HAS_GPS |
|---|
| 342 | int gps_record; |
|---|
| 343 | int gps_navi_show; |
|---|
| 344 | int gps_navi_hide; |
|---|
| 345 | int gps_kompass_show; |
|---|
| 346 | int gps_kompass_hide; |
|---|
| 347 | int gps_coordinates_show; |
|---|
| 348 | int gps_height_show; |
|---|
| 349 | int gps_waypoint_save; |
|---|
| 350 | int gps_track_time; |
|---|
| 351 | int gps_wait_for_signal; |
|---|
| 352 | int gps_kompass_time; |
|---|
| 353 | int gps_navi_time; |
|---|
| 354 | int gps_wait_for_signal_time; |
|---|
| 355 | int gps_kompass_smooth; |
|---|
| 356 | int gps_batt; |
|---|
| 357 | int gps_countdown; |
|---|
| 358 | int gps_2D_3D_fix; |
|---|
| 359 | int gps_countdown_blink; |
|---|
| 360 | int gps_rec_play_set; |
|---|
| 361 | int gps_play_dark_set; |
|---|
| 362 | int gps_rec_play_time; |
|---|
| 363 | int gps_play_dark_time; |
|---|
| 364 | int gps_rec_play_set_1; |
|---|
| 365 | int gps_play_dark_set_1; |
|---|
| 366 | int gps_rec_play_time_1; |
|---|
| 367 | int gps_play_dark_time_1; |
|---|
| 368 | int gps_show_symbol; |
|---|
| 369 | |
|---|
| 370 | int gps_batt_warn; |
|---|
| 371 | int gps_track_symbol; |
|---|
| 372 | int gps_test_timezone; |
|---|
| 373 | int gps_beep_warn; |
|---|
| 374 | int gps_on_off; |
|---|
| 375 | #endif |
|---|
| 376 | } Conf; |
|---|
| 377 | |
|---|
| 378 | extern Conf conf; |
|---|
| 379 | |
|---|
| 380 | #define ALT_PREVENT_SHUTDOWN_NO 0 |
|---|
| 381 | #define ALT_PREVENT_SHUTDOWN_ALT 1 |
|---|
| 382 | #define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2 |
|---|
| 383 | #define ALT_PREVENT_SHUTDOWN_ALWAYS 3 |
|---|
| 384 | |
|---|
| 385 | #define SHOOTING_PROGRESS_NONE 0 |
|---|
| 386 | #define SHOOTING_PROGRESS_STARTED 1 |
|---|
| 387 | #define SHOOTING_PROGRESS_PROCESSING 2 |
|---|
| 388 | #define SHOOTING_PROGRESS_DONE 3 |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | // video quality defaults. Ideally, these should match the camera default settings |
|---|
| 392 | #define VIDEO_DEFAULT_QUALITY 84 // ? where does 84 come from |
|---|
| 393 | #define VIDEO_MAX_QUALITY 99 |
|---|
| 394 | #define VIDEO_DEFAULT_BITRATE 3 // should be 1 for all cams |
|---|
| 395 | |
|---|
| 396 | extern void user_menu_restore(); |
|---|
| 397 | |
|---|
| 398 | extern int state_kbd_script_run; |
|---|
| 399 | extern int state_shooting_progress; |
|---|
| 400 | extern int state_save_raw_nth_only; |
|---|
| 401 | |
|---|
| 402 | extern void script_autostart(); // remote autostart |
|---|
| 403 | extern void conf_save(); |
|---|
| 404 | extern void conf_restore(); |
|---|
| 405 | extern void conf_load_defaults(); |
|---|
| 406 | extern int shutter_int; |
|---|
| 407 | extern void conf_change_dng(void); |
|---|
| 408 | extern void conf_update_prevent_shutdown(void); |
|---|
| 409 | extern int conf_getValue(unsigned short id, tConfigVal* configVal); |
|---|
| 410 | extern int conf_setValue(unsigned short id, tConfigVal configVal); |
|---|
| 411 | |
|---|
| 412 | // reyalp: putting these in conf, since the conf values are lookups for them |
|---|
| 413 | // prefixes and extentions available for raw images (index with conf.raw_prefix etc) |
|---|
| 414 | #define NUM_IMG_PREFIXES 3 // IMG_ CRW_ SND_ (could add ETC_ SDR_ AUT_ MVI_ MRK_) |
|---|
| 415 | #define NUM_IMG_EXTS 5 // .JPG .CRW .CR2 .THM .WAV (could add .AVI .MRK) |
|---|
| 416 | extern const char* img_prefixes[NUM_IMG_PREFIXES]; |
|---|
| 417 | extern const char* img_exts[NUM_IMG_EXTS]; |
|---|
| 418 | |
|---|
| 419 | extern int is_raw_enabled(); |
|---|
| 420 | |
|---|
| 421 | //------------------------------------------------------------------- |
|---|
| 422 | |
|---|
| 423 | typedef struct { |
|---|
| 424 | unsigned short id; |
|---|
| 425 | unsigned char size; |
|---|
| 426 | char type; |
|---|
| 427 | void *var; |
|---|
| 428 | union { |
|---|
| 429 | void *ptr; |
|---|
| 430 | int i; |
|---|
| 431 | color cl; |
|---|
| 432 | OSD_pos pos; |
|---|
| 433 | }; |
|---|
| 434 | // Since only a few of the ConfInfo entries have a 'func' it saves space to not store the function addresses in the ConfInfo struct |
|---|
| 435 | // handled in conf_info_func code |
|---|
| 436 | //void (*func)(); |
|---|
| 437 | } ConfInfo; |
|---|
| 438 | |
|---|
| 439 | #define CONF_INFO(id, param, type, def, func) { id, sizeof( param ), type, ¶m, {def}/*, func*/ } |
|---|
| 440 | #define CONF_INFO2(id, param, type, px, py) { id, sizeof( param ), type, ¶m, {pos:{px,py}} } |
|---|
| 441 | |
|---|
| 442 | extern void config_save(const ConfInfo *conf_info, char *filename, int conf_num); |
|---|
| 443 | extern void config_restore(const ConfInfo *confinfo, char *filename, int conf_num, void (*info_func)(unsigned short id)); |
|---|
| 444 | |
|---|
| 445 | //------------------------------------------------------------------- |
|---|
| 446 | |
|---|
| 447 | #endif |
|---|