CHDK_DE Vorschauversion  Trunk Rev. 5163
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
conf.h-Dateireferenz
#include "stdlib.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,3}
 
#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_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 506 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT   2

Definiert in Zeile 507 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALWAYS   3

Definiert in Zeile 508 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_NO   0

Definiert in Zeile 505 der Datei conf.h.

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

Definiert in Zeile 474 der Datei conf.h.

#define CONF_CHAR_PTR   4

Definiert in Zeile 27 der Datei conf.h.

#define CONF_DEF_VALUE   1

Definiert in Zeile 21 der Datei conf.h.

#define CONF_EMPTY   0

Definiert in Zeile 18 der Datei conf.h.

#define CONF_FUNC_PTR   2

Definiert in Zeile 23 der Datei conf.h.

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

Definiert in Zeile 563 der Datei conf.h.

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

Definiert in Zeile 564 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 565 der Datei conf.h.

#define CONF_INT_PTR   3

Definiert in Zeile 25 der Datei conf.h.

#define CONF_OSD_POS   5

Definiert in Zeile 29 der Datei conf.h.

#define CONF_STR_LEN   100

Definiert in Zeile 16 der Datei conf.h.

#define CONF_STRUCT_PTR   6

Definiert in Zeile 31 der Datei conf.h.

#define CONF_VALUE   1

Definiert in Zeile 20 der Datei conf.h.

#define CONF_VERSION   {3,3}

Definiert in Zeile 78 der Datei conf.h.

#define is_av_bracketing_enabled   ( conf.av_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 499 der Datei conf.h.

#define is_av_override_enabled   ( conf.av_override_enabled && overrides_are_enabled )

Definiert in Zeile 487 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 501 der Datei conf.h.

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

Definiert in Zeile 489 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 503 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 494 der Datei conf.h.

#define is_tv_bracketing_enabled   ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 497 der Datei conf.h.

#define NUM_IMG_EXTS   5

Definiert in Zeile 535 der Datei conf.h.

#define NUM_IMG_FOLDER_NAMES   3

Definiert in Zeile 533 der Datei conf.h.

#define NUM_IMG_PREFIXES   3

Definiert in Zeile 534 der Datei conf.h.

#define overrides_are_enabled   ( conf.override_disable != 1 )

Definiert in Zeile 472 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALT   3

Definiert in Zeile 519 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALWAYS   1

Definiert in Zeile 517 der Datei conf.h.

#define SCRIPT_AUTOSTART_NONE   0

Definiert in Zeile 516 der Datei conf.h.

#define SCRIPT_AUTOSTART_ONCE   2

Definiert in Zeile 518 der Datei conf.h.

#define SD_OVERRIDE_INFINITY   2

Definiert in Zeile 493 der Datei conf.h.

#define SD_OVERRIDE_OFF   0

Definiert in Zeile 491 der Datei conf.h.

#define SD_OVERRIDE_ON   1

Definiert in Zeile 492 der Datei conf.h.

#define SHOOTING_PROGRESS_DONE   3

Definiert in Zeile 513 der Datei conf.h.

#define SHOOTING_PROGRESS_NONE   0

Definiert in Zeile 510 der Datei conf.h.

#define SHOOTING_PROGRESS_PROCESSING   2

Definiert in Zeile 512 der Datei conf.h.

#define SHOOTING_PROGRESS_STARTED   1

Definiert in Zeile 511 der Datei conf.h.

#define TV_OVERRIDE_EV_STEP   0

Definiert in Zeile 477 der Datei conf.h.

#define TV_OVERRIDE_LONG_EXP   2

Definiert in Zeile 479 der Datei conf.h.

#define TV_OVERRIDE_SHORT_EXP   1

Definiert in Zeile 478 der Datei conf.h.

Dokumentation der Funktionen

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

Definiert in Zeile 31 der Datei conf.c.

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

Definiert in Zeile 1459 der Datei conf.c.

1460 {
1461  int i;
1462 
1463  if (id < CONF_CORE)
1464  id = conf_map_1_2[id]; // Convert old ID to new ID
1465 
1466  for (i=0; confinfo_handlers[i].ci != 0; i++)
1467  if ((id >= confinfo_handlers[i].start_id) && (id <= confinfo_handlers[i].end_id))
1468  return getValue(confinfo_handlers[i].ci, id - confinfo_handlers[i].start_id, configVal);
1469 
1470  return CONF_EMPTY;
1471 }
void conf_load_defaults ( )

Definiert in Zeile 1069 der Datei conf.c.

1070 {
1071  int i;
1072  for (i=0; confinfo_handlers[i].ci != 0; i++)
1074 }
void conf_restore ( )

Definiert in Zeile 1316 der Datei conf.c.

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

Definiert in Zeile 1156 der Datei conf.c.

1157 {
1158  int i;
1159  for (i=0; confinfo_handlers[i].ci != 0; i++)
1160  {
1162  {
1163  if (confinfo_handlers[i].start_id == CONF_USER)
1164  user_menu_save();
1165 
1166  config_save(confinfo_handlers[i].ci, confinfo_handlers[i].filename, confinfo_handlers[i].start_id);
1168  }
1169  }
1170  // Save current script parameters if they have changed.
1171  save_params_values(0);
1172 }
void conf_setAutosave ( int  n)

Definiert in Zeile 1571 der Datei conf.c.

1572 {
1573  config_autosave = (n == 0) ? 0 : 1;
1574 }
int conf_setValue ( unsigned short  id,
tConfigVal  configVal 
)

Definiert in Zeile 1557 der Datei conf.c.

1558 {
1559  int i;
1560 
1561  if (id < CONF_CORE)
1562  id = conf_map_1_2[id]; // Convert old ID to new ID
1563 
1564  for (i=0; confinfo_handlers[i].ci != 0; i++)
1565  if ((id >= confinfo_handlers[i].start_id) && (id <= confinfo_handlers[i].end_id))
1566  return setValue(confinfo_handlers[i].ci, id - confinfo_handlers[i].start_id, configVal, confinfo_handlers[i].info_func);
1567 
1568  return CONF_EMPTY;
1569 }
void conf_update_prevent_shutdown ( void  )
void config_restore ( ConfInfo confinfo,
const char *  filename,
void(*)(unsigned short id)  info_func 
)

Definiert in Zeile 1191 der Datei conf.c.

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

Definiert in Zeile 1085 der Datei conf.c.

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

Definiert in Zeile 1643 der Datei conf.c.

1644 {
1645  return is_raw_possible() && !is_raw_exception();
1646 }
int is_raw_possible ( )

Definiert in Zeile 1607 der Datei conf.c.

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

Definiert in Zeile 1353 der Datei conf.c.

1354 {
1355  int i;
1356  for (i=0; confinfo_handlers[i].ci != 0; i++)
1357  {
1358  if ((config_base >= confinfo_handlers[i].start_id) && (config_base <= confinfo_handlers[i].end_id))
1359  {
1360  config_restore(confinfo_handlers[i].ci, (filename != 0) ? filename : confinfo_handlers[i].filename, confinfo_handlers[i].info_func);
1361  if (filename == 0) // Reset 'last_saved' values if loading default file
1363  return 1;
1364  }
1365  }
1366  return 0;
1367 }
void resetColors ( )

Definiert in Zeile 1381 der Datei conf.c.

1382 {
1383  int i, n;
1384 
1385  // Iterate over color override ID's
1386  for (n=COLOR_FIRST_OVERRIDE; n<=COLOR_LAST_OVERRIDE; n++)
1387  {
1388  i = findConfInfo(osd_conf_info, n);
1389  if (i != -1)
1390  {
1391  *((confColor*)osd_conf_info[i].var) = osd_conf_info[i].cl;
1392  }
1393  }
1394 }
int save_config_file ( int  config_base,
const char *  filename 
)

Definiert in Zeile 1174 der Datei conf.c.

1175 {
1176  int i;
1177  for (i=0; confinfo_handlers[i].ci != 0; i++)
1178  {
1179  if ((config_base >= confinfo_handlers[i].start_id) && (config_base <= confinfo_handlers[i].end_id))
1180  {
1181  config_save(confinfo_handlers[i].ci, (filename != 0) ? filename : confinfo_handlers[i].filename, confinfo_handlers[i].start_id);
1182  if (filename == 0) // Reset 'last_saved' values after saving default file
1184  return 1;
1185  }
1186  }
1187  return 0;
1188 }

Variablen-Dokumentation

Conf conf

Definiert in Zeile 21 der Datei conf.c.

const char* img_exts[NUM_IMG_EXTS]

Definiert in Zeile 27 der Datei conf.c.

const char* img_folders[NUM_IMG_FOLDER_NAMES]

Definiert in Zeile 25 der Datei conf.c.

const char* img_prefixes[NUM_IMG_PREFIXES]

Definiert in Zeile 26 der Datei conf.c.