CHDK_DE Vorschauversion  Trunk Rev. 5830
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
conf.h-Dateireferenz
#include "stdlib.h"
#include "color.h"
#include "script.h"
+ Include-Abhängigkeitsdiagramm für conf.h:
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  OSD_pos
 
struct  OSD_scale
 
struct  tConfigVal
 
struct  tVarArrayConfig
 
struct  tUserMenuItem
 
struct  tUserMenuConfig
 
struct  Conf
 
struct  ConfInfo
 

Makrodefinitionen

#define CONF_STR_LEN   100
 
#define CONF_EMPTY   0
 
#define CONF_VALUE   1
 
#define CONF_DEF_VALUE   1
 
#define CONF_FUNC_PTR   2
 
#define CONF_INT_PTR   3
 
#define CONF_CHAR_PTR   4
 
#define CONF_OSD_POS   5
 
#define CONF_STRUCT_PTR   6
 
#define CONF_VERSION   {3,6}
 
#define overrides_are_enabled   ( conf.override_disable != 1 )
 
#define autoiso_and_bracketing_overrides_are_enabled   ( !(conf.override_disable == 1 && conf.override_disable_all) )
 
#define TV_OVERRIDE_EV_STEP   0
 
#define TV_OVERRIDE_SHORT_EXP   1
 
#define TV_OVERRIDE_LONG_EXP   2
 
#define is_tv_override_enabled
 
#define is_av_override_enabled   ( conf.av_override_enabled && overrides_are_enabled )
 
#define is_iso_override_enabled   ( conf.iso_override_value && conf.iso_override_koef && overrides_are_enabled )
 
#define SD_OVERRIDE_OFF   0
 
#define SD_OVERRIDE_ON   1
 
#define SD_OVERRIDE_INFINITY   2
 
#define is_sd_override_enabled   ( conf.subj_dist_override_value && conf.subj_dist_override_koef && overrides_are_enabled )
 
#define is_tv_bracketing_enabled   ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )
 
#define is_av_bracketing_enabled   ( conf.av_bracket_value && autoiso_and_bracketing_overrides_are_enabled )
 
#define is_iso_bracketing_enabled   ( conf.iso_bracket_value && conf.iso_bracket_koef && autoiso_and_bracketing_overrides_are_enabled )
 
#define is_sd_bracketing_enabled   ( conf.subj_dist_bracket_value && conf.subj_dist_bracket_koef && autoiso_and_bracketing_overrides_are_enabled && shooting_can_focus() )
 
#define ALT_PREVENT_SHUTDOWN_NO   0
 
#define ALT_PREVENT_SHUTDOWN_ALT   1
 
#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT   2
 
#define ALT_PREVENT_SHUTDOWN_ALWAYS   3
 
#define SHOOTING_PROGRESS_NONE   0
 
#define SHOOTING_PROGRESS_STARTED   1
 
#define SHOOTING_PROGRESS_PROCESSING   2
 
#define SHOOTING_PROGRESS_DONE   3
 
#define SCRIPT_AUTOSTART_NONE   0
 
#define SCRIPT_AUTOSTART_ALWAYS   1
 
#define SCRIPT_AUTOSTART_ONCE   2
 
#define SCRIPT_AUTOSTART_ALT   3
 
#define NUM_IMG_FOLDER_NAMES   3
 
#define NUM_IMG_PREFIXES   3
 
#define NUM_IMG_EXTS   5
 
#define CONF_INFO(id, param, type, def)   { id, sizeof( param ), type, &param, {def}, 0 }
 
#define CONF_INFO2(id, param, type, px, py)   { id, sizeof( param ), type, &param, {pos:{px,py}}, 0 }
 
#define CONF_INFOP(id, param, type, px, py)   { id, sizeof( param ), type, &param, {pos:{(px)*CAM_SCREEN_WIDTH/360,(py)*CAM_SCREEN_HEIGHT/240}}, 0 }
 
#define CONF_INFOC(id, param, type, bc, fc, bt, ft)   { id, sizeof( param ), type, &param, {cl:{fg:{fc,ft},bg:{bc,bt}}}, 0 }
 

Funktionen

void conf_save ()
 
void conf_restore ()
 
void conf_load_defaults ()
 
void conf_change_dng (void)
 
void conf_update_prevent_shutdown (void)
 
void cb_autoiso_menu_change (unsigned int item)
 
int conf_getValue (unsigned short id, tConfigVal *configVal)
 
int conf_setValue (unsigned short id, tConfigVal configVal)
 
void conf_setAutosave (int n)
 
int is_raw_enabled ()
 
int is_raw_possible ()
 
void config_save (ConfInfo *conf_info, const char *filename, int config_base)
 
void config_restore (ConfInfo *confinfo, const char *filename, void(*info_func)(unsigned short id))
 
int save_config_file (int config_base, const char *filename)
 
int load_config_file (int config_base, const char *filename)
 
void resetColors ()
 

Variablen

Conf conf
 
const char * img_folders [NUM_IMG_FOLDER_NAMES]
 
const char * img_prefixes [NUM_IMG_PREFIXES]
 
const char * img_exts [NUM_IMG_EXTS]
 

Makro-Dokumentation

#define ALT_PREVENT_SHUTDOWN_ALT   1

Definiert in Zeile 513 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT   2

Definiert in Zeile 514 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALWAYS   3

Definiert in Zeile 515 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_NO   0

Definiert in Zeile 512 der Datei conf.h.

#define autoiso_and_bracketing_overrides_are_enabled   ( !(conf.override_disable == 1 && conf.override_disable_all) )

Definiert in Zeile 481 der Datei conf.h.

#define CONF_CHAR_PTR   4

Definiert in Zeile 28 der Datei conf.h.

#define CONF_DEF_VALUE   1

Definiert in Zeile 22 der Datei conf.h.

#define CONF_EMPTY   0

Definiert in Zeile 19 der Datei conf.h.

#define CONF_FUNC_PTR   2

Definiert in Zeile 24 der Datei conf.h.

#define CONF_INFO (   id,
  param,
  type,
  def 
)    { id, sizeof( param ), type, &param, {def}, 0 }

Definiert in Zeile 570 der Datei conf.h.

#define CONF_INFO2 (   id,
  param,
  type,
  px,
  py 
)    { id, sizeof( param ), type, &param, {pos:{px,py}}, 0 }

Definiert in Zeile 571 der Datei conf.h.

#define CONF_INFOC (   id,
  param,
  type,
  bc,
  fc,
  bt,
  ft 
)    { id, sizeof( param ), type, &param, {cl:{fg:{fc,ft},bg:{bc,bt}}}, 0 }

Definiert in Zeile 573 der Datei conf.h.

#define CONF_INFOP (   id,
  param,
  type,
  px,
  py 
)    { id, sizeof( param ), type, &param, {pos:{(px)*CAM_SCREEN_WIDTH/360,(py)*CAM_SCREEN_HEIGHT/240}}, 0 }

Definiert in Zeile 572 der Datei conf.h.

#define CONF_INT_PTR   3

Definiert in Zeile 26 der Datei conf.h.

#define CONF_OSD_POS   5

Definiert in Zeile 30 der Datei conf.h.

#define CONF_STR_LEN   100

Definiert in Zeile 17 der Datei conf.h.

#define CONF_STRUCT_PTR   6

Definiert in Zeile 32 der Datei conf.h.

#define CONF_VALUE   1

Definiert in Zeile 21 der Datei conf.h.

#define CONF_VERSION   {3,6}

Definiert in Zeile 79 der Datei conf.h.

#define is_av_bracketing_enabled   ( conf.av_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 506 der Datei conf.h.

#define is_av_override_enabled   ( conf.av_override_enabled && overrides_are_enabled )

Definiert in Zeile 494 der Datei conf.h.

#define is_iso_bracketing_enabled   ( conf.iso_bracket_value && conf.iso_bracket_koef && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 508 der Datei conf.h.

#define is_iso_override_enabled   ( conf.iso_override_value && conf.iso_override_koef && overrides_are_enabled )

Definiert in Zeile 496 der Datei conf.h.

#define is_sd_bracketing_enabled   ( conf.subj_dist_bracket_value && conf.subj_dist_bracket_koef && autoiso_and_bracketing_overrides_are_enabled && shooting_can_focus() )

Definiert in Zeile 510 der Datei conf.h.

#define is_sd_override_enabled   ( conf.subj_dist_override_value && conf.subj_dist_override_koef && overrides_are_enabled )

Definiert in Zeile 501 der Datei conf.h.

#define is_tv_bracketing_enabled   ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 504 der Datei conf.h.

#define NUM_IMG_EXTS   5

Definiert in Zeile 542 der Datei conf.h.

#define NUM_IMG_FOLDER_NAMES   3

Definiert in Zeile 540 der Datei conf.h.

#define NUM_IMG_PREFIXES   3

Definiert in Zeile 541 der Datei conf.h.

#define overrides_are_enabled   ( conf.override_disable != 1 )

Definiert in Zeile 479 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALT   3

Definiert in Zeile 526 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALWAYS   1

Definiert in Zeile 524 der Datei conf.h.

#define SCRIPT_AUTOSTART_NONE   0

Definiert in Zeile 523 der Datei conf.h.

#define SCRIPT_AUTOSTART_ONCE   2

Definiert in Zeile 525 der Datei conf.h.

#define SD_OVERRIDE_INFINITY   2

Definiert in Zeile 500 der Datei conf.h.

#define SD_OVERRIDE_OFF   0

Definiert in Zeile 498 der Datei conf.h.

#define SD_OVERRIDE_ON   1

Definiert in Zeile 499 der Datei conf.h.

#define SHOOTING_PROGRESS_DONE   3

Definiert in Zeile 520 der Datei conf.h.

#define SHOOTING_PROGRESS_NONE   0

Definiert in Zeile 517 der Datei conf.h.

#define SHOOTING_PROGRESS_PROCESSING   2

Definiert in Zeile 519 der Datei conf.h.

#define SHOOTING_PROGRESS_STARTED   1

Definiert in Zeile 518 der Datei conf.h.

#define TV_OVERRIDE_EV_STEP   0

Definiert in Zeile 484 der Datei conf.h.

#define TV_OVERRIDE_LONG_EXP   2

Definiert in Zeile 486 der Datei conf.h.

#define TV_OVERRIDE_SHORT_EXP   1

Definiert in Zeile 485 der Datei conf.h.

Dokumentation der Funktionen

void cb_autoiso_menu_change ( unsigned int  item)
void conf_change_dng ( void  )

Definiert in Zeile 30 der Datei conf.c.

31 {
33  {
34  if (!libdng->badpixel_list_loaded_b()) libdng->load_bad_pixels_list_b("A/CHDK/badpixel.bin");
36  }
37 }
int conf_getValue ( unsigned short  id,
tConfigVal configVal 
)

Definiert in Zeile 1466 der Datei conf.c.

1467 {
1468  int i;
1469 
1470  if (id < CONF_CORE)
1471  id = conf_map_1_2[id]; // Convert old ID to new ID
1472 
1473  for (i=0; confinfo_handlers[i].ci != 0; i++)
1474  if ((id >= confinfo_handlers[i].start_id) && (id <= confinfo_handlers[i].end_id))
1475  return getValue(confinfo_handlers[i].ci, id - confinfo_handlers[i].start_id, configVal);
1476 
1477  return CONF_EMPTY;
1478 }
void conf_load_defaults ( )

Definiert in Zeile 1076 der Datei conf.c.

1077 {
1078  int i;
1079  for (i=0; confinfo_handlers[i].ci != 0; i++)
1081 }
void conf_restore ( )

Definiert in Zeile 1323 der Datei conf.c.

1324 {
1325  int i;
1326  int old_config_loaded = 0;
1327 
1328  // init some defaults values
1330 
1331  // Load all defaults first, in case we end up loading old file
1333 
1334  // Check if CORE config file exists, if not try loading old (1.2) file
1335  if (stat(confinfo_handlers[0].filename,0) != 0)
1336  old_config_loaded = config_restore_1_2("A/CHDK/CCHDK3.CFG");
1337 
1338  // Load all new files (that exist)
1339  for (i=0; confinfo_handlers[i].ci != 0; i++)
1340  {
1341  config_restore(confinfo_handlers[i].ci, confinfo_handlers[i].filename, confinfo_handlers[i].info_func);
1342  if (old_config_loaded == 0)
1344  }
1345 
1346  // clear any "clear on restart" values
1347  clear_values();
1348 
1349 // Enable Lua native calls if builder wants them forced on
1350 #if defined(OPT_FORCE_LUA_CALL_NATIVE)
1352 #endif
1353 
1354 // If curves not compiled in force option off
1355 #if !defined(OPT_CURVES)
1356  conf.curve_enable = 0;
1357 #endif
1358 }
void conf_save ( )

Definiert in Zeile 1163 der Datei conf.c.

1164 {
1165  int i;
1166  for (i=0; confinfo_handlers[i].ci != 0; i++)
1167  {
1169  {
1170  if (confinfo_handlers[i].start_id == CONF_USER)
1171  user_menu_save();
1172 
1173  config_save(confinfo_handlers[i].ci, confinfo_handlers[i].filename, confinfo_handlers[i].start_id);
1175  }
1176  }
1177  // Save current script parameters if they have changed.
1178  save_params_values(0);
1179 }
void conf_setAutosave ( int  n)

Definiert in Zeile 1578 der Datei conf.c.

1579 {
1580  config_autosave = (n == 0) ? 0 : 1;
1581 }
int conf_setValue ( unsigned short  id,
tConfigVal  configVal 
)

Definiert in Zeile 1564 der Datei conf.c.

1565 {
1566  int i;
1567 
1568  if (id < CONF_CORE)
1569  id = conf_map_1_2[id]; // Convert old ID to new ID
1570 
1571  for (i=0; confinfo_handlers[i].ci != 0; i++)
1572  if ((id >= confinfo_handlers[i].start_id) && (id <= confinfo_handlers[i].end_id))
1573  return setValue(confinfo_handlers[i].ci, id - confinfo_handlers[i].start_id, configVal, confinfo_handlers[i].info_func);
1574 
1575  return CONF_EMPTY;
1576 }
void conf_update_prevent_shutdown ( void  )
void config_restore ( ConfInfo confinfo,
const char *  filename,
void(*)(unsigned short id)  info_func 
)

Definiert in Zeile 1198 der Datei conf.c.

1199 {
1200  int rcnt, i, offs;
1201  unsigned short id, size;
1202 
1203  char* buf = load_file(filename, &rcnt, 0);
1204 
1205  if (buf)
1206  {
1207  if (*(int*)buf == CONF_MAGICK_VALUE)
1208  {
1209  offs = 2 * sizeof(int);
1210  while (1)
1211  {
1212  if (offs + (int)sizeof(short) > rcnt)
1213  break;
1214  id = *((short*)(buf + offs));
1215  offs += sizeof(short);
1216 
1217  if (offs + (int)sizeof(short) > rcnt)
1218  break;
1219  size = *((short*)(buf + offs));
1220  offs += sizeof(short);
1221 
1222  for (i=0; ci[i].id > 0; ++i)
1223  {
1224  if (ci[i].id==id && ci[i].size==size)
1225  {
1226  if (offs + size <= rcnt)
1227  {
1228  if (ci[i].type == CONF_STRUCT_PTR)
1229  {
1230  tVarArrayConfig *cfg = (tVarArrayConfig*)(ci[i].var);
1231  size = cfg->load(buf+offs);
1232  }
1233  else if (ci[i].size == size) // only restore if size matches
1234  {
1235  memcpy(ci[i].var, buf+offs, size);
1236  }
1237  if (info_func) info_func(ci[i].id);
1238  }
1239  break;
1240  }
1241  }
1242 
1243  offs += size;
1244  }
1245  }
1246  free(buf);
1247  }
1248 }
void config_save ( ConfInfo conf_info,
const char *  filename,
int  config_base 
)

Definiert in Zeile 1092 der Datei conf.c.

1093 {
1094 // if Lua native calls are forced on, don't save state to config file since user did not select it
1095 #if defined(OPT_FORCE_LUA_CALL_NATIVE)
1097 #endif
1098 
1099  register int i;
1100 
1101  for (i=0; ci[i].id > 0; i++); // Find # of items
1102 
1103  int size = 2 * sizeof(int) + i * sizeof(ConfInfoSave);
1104 
1105  for (i=0; ci[i].id > 0; i++)
1106  {
1107  if (ci[i].type == CONF_STRUCT_PTR)
1108  {
1109  tVarArrayConfig *cfg = (tVarArrayConfig*)(ci[i].var);
1110  size += cfg->saved_size();
1111  }
1112  else
1113  {
1114  size += ci[i].size;
1115  }
1116  }
1117 
1118  char *buf = umalloc(size);
1119  char *p = buf;
1120 
1121  int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0777);
1122  if (fd >= 0)
1123  {
1124  int t = CONF_MAGICK_VALUE;
1125  memcpy(p, &t, sizeof(t));
1126  p += sizeof(t);
1127 
1128  t = config_base;
1129  memcpy(p, &t, sizeof(t));
1130  p += sizeof(t);
1131 
1132  for (i=0; ci[i].id > 0; ++i)
1133  {
1134  ((ConfInfoSave*)p)->id = ci[i].id;
1135  ((ConfInfoSave*)p)->size = ci[i].size;
1136  p += sizeof(ConfInfoSave);
1137  if (ci[i].type == CONF_STRUCT_PTR)
1138  {
1139  tVarArrayConfig *cfg = (tVarArrayConfig*)(ci[i].var);
1140  p = cfg->save(p);
1141  }
1142  else
1143  {
1144  memcpy(p, ci[i].var, ci[i].size);
1145  // Clear out unused space after string config item value
1146  if ((ci[i].size == CONF_STR_LEN) && (strlen(ci[i].var) < CONF_STR_LEN))
1147  memset(p+strlen(ci[i].var), 0, CONF_STR_LEN-strlen(ci[i].var));
1148  p += ci[i].size;
1149  }
1150  }
1151 
1152  write(fd, buf, p-buf);
1153  close(fd);
1154  }
1155  ufree(buf);
1156 
1157 // if Lua native calls are forced on, re-enable native calls
1158 #if defined(OPT_FORCE_LUA_CALL_NATIVE)
1160 #endif
1161 }
int is_raw_enabled ( )

Definiert in Zeile 1649 der Datei conf.c.

1650 {
1651  return is_raw_possible() && !is_raw_exception();
1652 }
int is_raw_possible ( )

Definiert in Zeile 1614 der Datei conf.c.

1614  {
1615  return !(0 // Return false if any of these tests are true
1616 #ifdef CAM_DISABLE_RAW_IN_AUTO
1617  || (camera_info.state.mode_shooting == MODE_AUTO) // some cameras don't have valid raw in auto mode
1618 #endif
1620  || (camera_info.state.mode_shooting == MODE_ISO_3200) // some cameras don't have valid raw in ISO3200 binned mode, not the same as low light
1621 #endif
1622 #ifdef CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE
1623  || (shooting_get_resolution()==7) // True if shooting resolution is 'low light'
1624 #endif
1625 #if defined(CAM_DISABLE_RAW_IN_HQ_BURST)
1626  || (camera_info.state.mode_shooting == MODE_HIGHSPEED_BURST) // True if HQ Burst mode (SX40HS corrupts JPEG images if RAW enabled in this mode)
1627 #endif
1629  || (camera_info.state.mode_shooting == MODE_NIGHT_SCENE) // True if HandHeld Night Scene (SX40HS corrupts JPEG images if RAW enabled in this mode)
1630 #endif
1631 #if defined(CAM_DISABLE_RAW_IN_DIGITAL_IS)
1632  || (camera_info.state.mode_shooting == MODE_DIGITAL_IS) // True if Digital IS mode (ixus160_elph160 crashes if RAW enabled in this mode)
1633 #endif
1634 #if defined(CAM_DISABLE_RAW_IN_HYBRID_AUTO)
1635  || (camera_info.state.mode_shooting == MODE_HYBRID_AUTO) // True if Hybrid Auto mode (SX280HS raw hook conflicts with the saving of digest movie)
1636 #endif
1637 #if defined(CAM_DISABLE_RAW_IN_MOVIE_DIGEST)
1638  || (camera_info.state.mode_shooting == MODE_VIDEO_MOVIE_DIGEST) // True if Movie Digest mode (SX510HS raw hook conflicts with the saving of digest movie)
1639 #endif
1640 #if defined(CAM_DISABLE_RAW_IN_SPORTS)
1641  || (camera_info.state.mode_shooting == MODE_SPORTS) // True if Sports mode (SX280HS, multiple issues with raw buffer; storing raw makes little sense in this mode anyway)
1642 #endif
1643 #if defined(CAM_DISABLE_RAW_IN_HDR)
1644  || (camera_info.state.mode_shooting == MODE_HDR) // True if HDR mode (G7X)
1645 #endif
1646  );
1647 }
int load_config_file ( int  config_base,
const char *  filename 
)

Definiert in Zeile 1360 der Datei conf.c.

1361 {
1362  int i;
1363  for (i=0; confinfo_handlers[i].ci != 0; i++)
1364  {
1365  if ((config_base >= confinfo_handlers[i].start_id) && (config_base <= confinfo_handlers[i].end_id))
1366  {
1367  config_restore(confinfo_handlers[i].ci, (filename != 0) ? filename : confinfo_handlers[i].filename, confinfo_handlers[i].info_func);
1368  if (filename == 0) // Reset 'last_saved' values if loading default file
1370  return 1;
1371  }
1372  }
1373  return 0;
1374 }
void resetColors ( )

Definiert in Zeile 1388 der Datei conf.c.

1389 {
1390  int i, n;
1391 
1392  // Iterate over color override ID's
1393  for (n=COLOR_FIRST_OVERRIDE; n<=COLOR_LAST_OVERRIDE; n++)
1394  {
1395  i = findConfInfo(osd_conf_info, n);
1396  if (i != -1)
1397  {
1398  *((confColor*)osd_conf_info[i].var) = osd_conf_info[i].cl;
1399  }
1400  }
1401 }
int save_config_file ( int  config_base,
const char *  filename 
)

Definiert in Zeile 1181 der Datei conf.c.

1182 {
1183  int i;
1184  for (i=0; confinfo_handlers[i].ci != 0; i++)
1185  {
1186  if ((config_base >= confinfo_handlers[i].start_id) && (config_base <= confinfo_handlers[i].end_id))
1187  {
1188  config_save(confinfo_handlers[i].ci, (filename != 0) ? filename : confinfo_handlers[i].filename, confinfo_handlers[i].start_id);
1189  if (filename == 0) // Reset 'last_saved' values after saving default file
1191  return 1;
1192  }
1193  }
1194  return 0;
1195 }

Variablen-Dokumentation

Conf conf

Definiert in Zeile 20 der Datei conf.c.

const char* img_exts[NUM_IMG_EXTS]

Definiert in Zeile 26 der Datei conf.c.

const char* img_folders[NUM_IMG_FOLDER_NAMES]

Definiert in Zeile 24 der Datei conf.c.

const char* img_prefixes[NUM_IMG_PREFIXES]

Definiert in Zeile 25 der Datei conf.c.