CHDK_DE Vorschauversion  Trunk Rev. 5579
 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,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 512 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT   2

Definiert in Zeile 513 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALWAYS   3

Definiert in Zeile 514 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_NO   0

Definiert in Zeile 511 der Datei conf.h.

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

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

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

Definiert in Zeile 570 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 572 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 571 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,6}

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 505 der Datei conf.h.

#define is_av_override_enabled   ( conf.av_override_enabled && overrides_are_enabled )

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

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

Definiert in Zeile 495 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 509 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 500 der Datei conf.h.

#define is_tv_bracketing_enabled   ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 503 der Datei conf.h.

#define NUM_IMG_EXTS   5

Definiert in Zeile 541 der Datei conf.h.

#define NUM_IMG_FOLDER_NAMES   3

Definiert in Zeile 539 der Datei conf.h.

#define NUM_IMG_PREFIXES   3

Definiert in Zeile 540 der Datei conf.h.

#define overrides_are_enabled   ( conf.override_disable != 1 )

Definiert in Zeile 478 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALT   3

Definiert in Zeile 525 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALWAYS   1

Definiert in Zeile 523 der Datei conf.h.

#define SCRIPT_AUTOSTART_NONE   0

Definiert in Zeile 522 der Datei conf.h.

#define SCRIPT_AUTOSTART_ONCE   2

Definiert in Zeile 524 der Datei conf.h.

#define SD_OVERRIDE_INFINITY   2

Definiert in Zeile 499 der Datei conf.h.

#define SD_OVERRIDE_OFF   0

Definiert in Zeile 497 der Datei conf.h.

#define SD_OVERRIDE_ON   1

Definiert in Zeile 498 der Datei conf.h.

#define SHOOTING_PROGRESS_DONE   3

Definiert in Zeile 519 der Datei conf.h.

#define SHOOTING_PROGRESS_NONE   0

Definiert in Zeile 516 der Datei conf.h.

#define SHOOTING_PROGRESS_PROCESSING   2

Definiert in Zeile 518 der Datei conf.h.

#define SHOOTING_PROGRESS_STARTED   1

Definiert in Zeile 517 der Datei conf.h.

#define TV_OVERRIDE_EV_STEP   0

Definiert in Zeile 483 der Datei conf.h.

#define TV_OVERRIDE_LONG_EXP   2

Definiert in Zeile 485 der Datei conf.h.

#define TV_OVERRIDE_SHORT_EXP   1

Definiert in Zeile 484 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 1464 der Datei conf.c.

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

Definiert in Zeile 1074 der Datei conf.c.

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

Definiert in Zeile 1321 der Datei conf.c.

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

Definiert in Zeile 1161 der Datei conf.c.

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

Definiert in Zeile 1576 der Datei conf.c.

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

Definiert in Zeile 1562 der Datei conf.c.

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

Definiert in Zeile 1196 der Datei conf.c.

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

Definiert in Zeile 1090 der Datei conf.c.

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

Definiert in Zeile 1648 der Datei conf.c.

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

Definiert in Zeile 1612 der Datei conf.c.

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

Definiert in Zeile 1358 der Datei conf.c.

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

Definiert in Zeile 1386 der Datei conf.c.

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

Definiert in Zeile 1179 der Datei conf.c.

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

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.