CHDK_DE Vorschauversion  Trunk Rev. 5215
 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,4}
 
#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 508 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT   2

Definiert in Zeile 509 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_ALWAYS   3

Definiert in Zeile 510 der Datei conf.h.

#define ALT_PREVENT_SHUTDOWN_NO   0

Definiert in Zeile 507 der Datei conf.h.

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

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

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

Definiert in Zeile 566 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 568 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 567 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,4}

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

#define is_av_override_enabled   ( conf.av_override_enabled && overrides_are_enabled )

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

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

Definiert in Zeile 491 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 505 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 496 der Datei conf.h.

#define is_tv_bracketing_enabled   ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )

Definiert in Zeile 499 der Datei conf.h.

#define NUM_IMG_EXTS   5

Definiert in Zeile 537 der Datei conf.h.

#define NUM_IMG_FOLDER_NAMES   3

Definiert in Zeile 535 der Datei conf.h.

#define NUM_IMG_PREFIXES   3

Definiert in Zeile 536 der Datei conf.h.

#define overrides_are_enabled   ( conf.override_disable != 1 )

Definiert in Zeile 474 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALT   3

Definiert in Zeile 521 der Datei conf.h.

#define SCRIPT_AUTOSTART_ALWAYS   1

Definiert in Zeile 519 der Datei conf.h.

#define SCRIPT_AUTOSTART_NONE   0

Definiert in Zeile 518 der Datei conf.h.

#define SCRIPT_AUTOSTART_ONCE   2

Definiert in Zeile 520 der Datei conf.h.

#define SD_OVERRIDE_INFINITY   2

Definiert in Zeile 495 der Datei conf.h.

#define SD_OVERRIDE_OFF   0

Definiert in Zeile 493 der Datei conf.h.

#define SD_OVERRIDE_ON   1

Definiert in Zeile 494 der Datei conf.h.

#define SHOOTING_PROGRESS_DONE   3

Definiert in Zeile 515 der Datei conf.h.

#define SHOOTING_PROGRESS_NONE   0

Definiert in Zeile 512 der Datei conf.h.

#define SHOOTING_PROGRESS_PROCESSING   2

Definiert in Zeile 514 der Datei conf.h.

#define SHOOTING_PROGRESS_STARTED   1

Definiert in Zeile 513 der Datei conf.h.

#define TV_OVERRIDE_EV_STEP   0

Definiert in Zeile 479 der Datei conf.h.

#define TV_OVERRIDE_LONG_EXP   2

Definiert in Zeile 481 der Datei conf.h.

#define TV_OVERRIDE_SHORT_EXP   1

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

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

Definiert in Zeile 1071 der Datei conf.c.

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

Definiert in Zeile 1318 der Datei conf.c.

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

Definiert in Zeile 1158 der Datei conf.c.

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

Definiert in Zeile 1573 der Datei conf.c.

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

Definiert in Zeile 1559 der Datei conf.c.

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

Definiert in Zeile 1193 der Datei conf.c.

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

Definiert in Zeile 1087 der Datei conf.c.

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

Definiert in Zeile 1645 der Datei conf.c.

1646 {
1647  return is_raw_possible() && !is_raw_exception();
1648 }
int is_raw_possible ( )

Definiert in Zeile 1609 der Datei conf.c.

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

Definiert in Zeile 1355 der Datei conf.c.

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

Definiert in Zeile 1383 der Datei conf.c.

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

Definiert in Zeile 1176 der Datei conf.c.

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

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.