CHDK_DE Vorschauversion  Trunk Rev. 5163
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
conf.c-Dateireferenz
#include "platform.h"
#include "conf.h"
#include "histogram.h"
#include "font.h"
#include "raw.h"
#include "gui.h"
#include "gui_draw.h"
#include "gui_osd.h"
#include "gui_lang.h"
#include "gui_menu.h"
#include "gui_user_menu.h"
#include "core.h"
#include "fileutil.h"
#include "lang.h"
#include "usb_remote.h"
#include "modules.h"
#include "module_def.h"
+ Include-Abhängigkeitsdiagramm für conf.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  confinfo_handler
 
struct  ConfInfoSave
 

Makrodefinitionen

#define COLOR_FIRST_OVERRIDE   50
 
#define COLOR_LAST_OVERRIDE   63
 
#define CONF_CORE   1000
 
#define CONF_OSD   2000
 
#define CONF_USER   3000
 
#define CONF_GPS   4000
 
#define CONF_FILE   "A/CHDK/CCHDK4.CFG"
 
#define OSD_CONF_FILE   "A/CHDK/OSD__4.CFG"
 
#define USER_MENU_CONF_FILE   "A/CHDK/UMENU4.CFG"
 
#define GPS_CONF_FILE   "A/CHDK/GPS__4.CFG"
 
#define CONF_MAGICK_VALUE   (0x33204741)
 

Funktionen

void conf_change_dng (void)
 
void conf_update_prevent_shutdown (void)
 
void clear_values ()
 
void user_menu_conf_info_func (unsigned short id)
 
void osd_conf_info_func (unsigned short id)
 
void conf_info_func (unsigned short id)
 
unsigned int memhash31 (unsigned char *mem, int len)
 
static void config_update_last_saved (ConfInfo *ci)
 
static int config_has_changed (ConfInfo *ci)
 
static void config_load_defaults (ConfInfo *ci, void(*info_func)(unsigned short id))
 
void conf_load_defaults ()
 
void config_save (ConfInfo *ci, const char *filename, int config_base)
 
void conf_save ()
 
int save_config_file (int config_base, const char *filename)
 
void config_restore (ConfInfo *ci, const char *filename, void(*info_func)(unsigned short id))
 
static int config_restore_1_2 (const char *filename)
 
void conf_restore ()
 
int load_config_file (int config_base, const char *filename)
 
static int findConfInfo (ConfInfo *ci, unsigned short id)
 
void resetColors ()
 
static int getValue (ConfInfo *ci, unsigned short id, tConfigVal *configVal)
 
int conf_getValue (unsigned short id, tConfigVal *configVal)
 
static int setValue (ConfInfo *ci, unsigned short id, tConfigVal configVal, void(*info_func)(unsigned short id))
 
int conf_setValue (unsigned short id, tConfigVal configVal)
 
void conf_setAutosave (int n)
 
int is_raw_exception ()
 
int is_raw_possible ()
 
int is_raw_enabled ()
 

Variablen

Conf conf
 
const char * img_folders [NUM_IMG_FOLDER_NAMES] ={ "A/DCIM", "withJPG", "A/RAW" }
 
const char * img_prefixes [NUM_IMG_PREFIXES] ={ "IMG_", "CRW_", "SND_" }
 
const char * img_exts [NUM_IMG_EXTS] ={ ".JPG", ".CRW", ".CR2", ".THM", ".WAV"}
 
static ConfInfo user_menu_conf_info []
 
static ConfInfo osd_conf_info []
 
static ConfInfo conf_info []
 
static const confinfo_handler confinfo_handlers []
 
static short conf_map_1_2 []
 
static int config_autosave = 1
 

Makro-Dokumentation

#define COLOR_FIRST_OVERRIDE   50

Definiert in Zeile 162 der Datei conf.c.

#define COLOR_LAST_OVERRIDE   63

Definiert in Zeile 163 der Datei conf.c.

#define CONF_CORE   1000

Definiert in Zeile 624 der Datei conf.c.

#define CONF_FILE   "A/CHDK/CCHDK4.CFG"

Definiert in Zeile 629 der Datei conf.c.

#define CONF_GPS   4000

Definiert in Zeile 627 der Datei conf.c.

#define CONF_MAGICK_VALUE   (0x33204741)

Definiert in Zeile 633 der Datei conf.c.

#define CONF_OSD   2000

Definiert in Zeile 625 der Datei conf.c.

#define CONF_USER   3000

Definiert in Zeile 626 der Datei conf.c.

#define GPS_CONF_FILE   "A/CHDK/GPS__4.CFG"

Definiert in Zeile 632 der Datei conf.c.

#define OSD_CONF_FILE   "A/CHDK/OSD__4.CFG"

Definiert in Zeile 630 der Datei conf.c.

#define USER_MENU_CONF_FILE   "A/CHDK/UMENU4.CFG"

Definiert in Zeile 631 der Datei conf.c.

Dokumentation der Funktionen

void clear_values ( )

Definiert in Zeile 67 der Datei conf.c.

68 {
69 
70 #if CAM_ADJUSTABLE_ALT_BUTTON
71  extern const char* gui_alt_mode_button_enum(int change, int arg);
72  gui_alt_mode_button_enum(0,0); // will reset if not in list of valid alt buttons
73 #else
74  conf.alt_mode_button = CAM_DEFAULT_ALT_BUTTON; // if not adjustable, force to default
75 #endif
76 
77  if (conf.platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
78  {
79  conf.fast_ev = 0;
84 
85  // remote input channel - all cams assumed to support USB
86  // TODO could reset only if invalid on current cam
88 
89  // video related entries are interpreted differently on D6 cameras
90  conf.video_mode = 0;
94 #ifdef CAM_MOVIEREC_NEWSTYLE
96 #endif
97  }
98  if (conf.osd_platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
99  {
100  conf.zoom_scale = 100;
101  // battery voltages are camera dependent
105 
106  conf.mem_view_addr_init = 0x1000;
107 
108  }
109 
110  if (conf.clear_override)
111  {
117  }
118  if (conf.clear_bracket)
119  {
124  }
125  if (conf.clear_video)
126  {
127  conf.video_mode = 0;
128 #if CAM_CHDK_HAS_EXT_VIDEO_TIME
130 #endif
134 #ifdef CAM_MOVIEREC_NEWSTYLE
136 #endif
137  }
138  //conf.edge_overlay_pano = 0; // reset it because otherwise this feature cant be used at startup (when buffer is empty) - needs workaround other than this!
139 }
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_info_func ( unsigned short  id)

Definiert in Zeile 534 der Datei conf.c.

535 {
536  switch (id)
537  {
538  case 20:
539  case 36:
540  case 37:
541  conf_change_dng();
542  break;
543 #if defined (DNG_EXT_FROM)
544  case 38:
545  {
546  extern void save_ext_for_dng(void);
547  save_ext_for_dng();
548  cb_change_dng_usb_ext();
549  }
550  break;
551 #endif
552  case 54:
554  break;
555 #ifdef CAM_MOVIEREC_NEWSTYLE
556  case 81:
558  break;
559 #endif
560  case 82:
562  break;
563  case 200:
564  case 204:
565  case 205: // USB Remote
566  case 208:
568  break;
569  case 220:
570 #ifndef CAM_ADJUSTABLE_ALT_BUTTON
572 #endif
573  break;
574  case 221:
576  break;
577  }
578 }
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  )
static int config_has_changed ( ConfInfo ci)
static

Definiert in Zeile 1004 der Datei conf.c.

1005 {
1006  int i;
1007  for (i=0; ci[i].id > 0; ++i)
1008  {
1009  switch (ci[i].type)
1010  {
1011  case CONF_OSD_POS:
1012  case CONF_DEF_VALUE:
1013  case CONF_FUNC_PTR:
1014  switch (ci[i].size)
1015  {
1016  case sizeof(int):
1017  if (ci[i].last_saved != (unsigned int)*((int*)ci[i].var))
1018  return 1;
1019  break;
1020  case sizeof(short):
1021  if (ci[i].last_saved != (unsigned int)*((short*)ci[i].var))
1022  return 1;
1023  break;
1024  case sizeof(char):
1025  if (ci[i].last_saved != (unsigned int)*((char*)ci[i].var))
1026  return 1;
1027  break;
1028  }
1029  break;
1030  case CONF_INT_PTR:
1031  if (ci[i].last_saved != memhash31((unsigned char*)ci[i].var, ci[i].size))
1032  return 1;
1033  break;
1034  case CONF_CHAR_PTR:
1035  if (ci[i].last_saved != lang_strhash31((int)ci[i].var))
1036  return 1;
1037  break;
1038  }
1039  }
1040 
1041  return 0;
1042 }
static void config_load_defaults ( ConfInfo ci,
void(*)(unsigned short id)  info_func 
)
static

Definiert in Zeile 1045 der Datei conf.c.

1046 {
1047  register int i;
1048 
1049  for (i=0; ci[i].id > 0; ++i) {
1050  switch (ci[i].type) {
1051  case CONF_OSD_POS:
1052  case CONF_DEF_VALUE:
1053  memcpy(ci[i].var, &(ci[i].i), ci[i].size);
1054  break;
1055  case CONF_INT_PTR:
1056  memset(ci[i].var, 0, ci[i].size);
1057  break;
1058  case CONF_FUNC_PTR:
1059  *((int*)ci[i].var) = ci[i].func();
1060  break;
1061  case CONF_CHAR_PTR:
1062  memcpy(ci[i].var, ci[i].ptr, ci[i].size);
1063  break;
1064  }
1065  if (info_func) info_func(ci[i].id);
1066  }
1067 }
void config_restore ( ConfInfo ci,
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 }
static int config_restore_1_2 ( const char *  filename)
static

Definiert in Zeile 1244 der Datei conf.c.

1245 {
1246  int rv = 0;
1247  int rcnt, i, offs;
1248  unsigned short id, size;
1249 
1250  char* buf = load_file(filename, &rcnt, 0);
1251 
1252  if (buf)
1253  {
1254  if (*(int*)buf == CONF_MAGICK_VALUE)
1255  {
1256  rv = 1;
1257  offs = sizeof(int);
1258  while (1)
1259  {
1260  if (offs + sizeof(short) > rcnt)
1261  break;
1262  id = conf_map_1_2[*((short*)(buf + offs))];
1263  offs += sizeof(short);
1264 
1265  if (offs + sizeof(short) > rcnt)
1266  break;
1267  size = *((short*)(buf + offs));
1268  offs += sizeof(short);
1269 
1270  ConfInfo *ci = 0;
1271  void (*info_func)(unsigned short id) = 0;
1272  for (i=0; confinfo_handlers[i].ci != 0; i++)
1273  {
1274  if ((id >= confinfo_handlers[i].start_id) && (id <= confinfo_handlers[i].end_id))
1275  {
1276  ci = confinfo_handlers[i].ci;
1277  info_func = confinfo_handlers[i].info_func;
1278  id -= confinfo_handlers[i].start_id;
1279  break;
1280  }
1281  }
1282 
1283  if (ci != 0)
1284  {
1285  for (i=0; ci[i].id > 0; ++i)
1286  {
1287  if (ci[i].id==id && ci[i].size==size)
1288  {
1289  if (offs + size <= rcnt)
1290  {
1291  if (ci[i].type == CONF_STRUCT_PTR)
1292  {
1293  tVarArrayConfig *cfg = (tVarArrayConfig*)(ci[i].var);
1294  size = cfg->load(buf+offs);
1295  }
1296  else
1297  {
1298  memcpy(ci[i].var, buf+offs, size);
1299  }
1300  if (info_func) info_func(ci[i].id);
1301  }
1302  break;
1303  }
1304  }
1305  }
1306 
1307  offs += size;
1308  }
1309  }
1310  free(buf);
1311  }
1312 
1313  return rv;
1314 }
void config_save ( ConfInfo ci,
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 }
static void config_update_last_saved ( ConfInfo ci)
static

Definiert in Zeile 971 der Datei conf.c.

972 {
973  int i;
974  for (i=0; ci[i].id > 0; ++i)
975  {
976  switch (ci[i].type)
977  {
978  case CONF_OSD_POS:
979  case CONF_DEF_VALUE:
980  case CONF_FUNC_PTR:
981  switch (ci[i].size)
982  {
983  case sizeof(int):
984  ci[i].last_saved = (unsigned int)*((int*)ci[i].var);
985  break;
986  case sizeof(short):
987  ci[i].last_saved = (unsigned int)*((short*)ci[i].var);
988  break;
989  case sizeof(char):
990  ci[i].last_saved = (unsigned int)*((char*)ci[i].var);
991  break;
992  }
993  break;
994  case CONF_INT_PTR:
995  ci[i].last_saved = memhash31((unsigned char*)ci[i].var, ci[i].size);
996  break;
997  case CONF_CHAR_PTR:
998  ci[i].last_saved = lang_strhash31((int)ci[i].var);
999  break;
1000  }
1001  }
1002 }
static int findConfInfo ( ConfInfo ci,
unsigned short  id 
)
static

Definiert in Zeile 1371 der Datei conf.c.

1372 {
1373  int i;
1374  for( i=0; ci[i].id > 0; ++i )
1375  if( ci[i].id==id )
1376  return i;
1377  return -1;
1378 }
static int getValue ( ConfInfo ci,
unsigned short  id,
tConfigVal configVal 
)
static

Definiert in Zeile 1397 der Datei conf.c.

1398 {
1399  int i;
1400  int ret = CONF_EMPTY;
1401  OSD_pos* pos;
1402 
1403  if (id == 0)
1404  {
1405  configVal->numb = 0;
1406  for ( i=0; ci[i].id > 0; ++i )
1407  if ( configVal->numb<ci[i].id )
1408  configVal->numb = ci[i].id;
1409  ret = CONF_VALUE;
1410  }
1411  else
1412  {
1413  i = findConfInfo(ci, id);
1414  if (i != -1)
1415  {
1416  switch( ci[i].type )
1417  {
1418  case CONF_VALUE:
1419  case CONF_FUNC_PTR:
1420  switch( ci[i].size )
1421  {
1422  case sizeof(int):
1423  configVal->numb = *(int*)ci[i].var;
1424  ret = CONF_VALUE;
1425  break;
1426  case sizeof(short):
1427  configVal->numb = *(short*)ci[i].var;
1428  ret = CONF_VALUE;
1429  break;
1430  case sizeof(char):
1431  configVal->numb = *(char*)ci[i].var;
1432  ret = CONF_VALUE;
1433  break;
1434  }
1435  configVal->pInt = (int*)ci[i].var;
1436  break;
1437  case CONF_INT_PTR:
1438  configVal->numb = ci[i].size/sizeof(int);
1439  configVal->pInt = (int*)ci[i].var;
1440  ret = CONF_INT_PTR;
1441  break;
1442  case CONF_CHAR_PTR:
1443  configVal->str = ci[i].var;
1444  ret = CONF_CHAR_PTR;
1445  break;
1446  case CONF_OSD_POS:
1447  pos = (OSD_pos*)ci[i].var;
1448  configVal->pos.x = pos->x;
1449  configVal->pos.y = pos->y;
1450  ret = CONF_OSD_POS;
1451  configVal->pInt = (int*)ci[i].var;
1452  break;
1453  }
1454  }
1455  }
1456  return ret;
1457 }
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_exception ( )

Definiert in Zeile 1582 der Datei conf.c.

1582  {
1584  // NOTE: the conf.save_raw_in variables are negative logic
1585  // 1 = disable saving raw in this mode, 0 = allow saving raw
1586  // variables should be named conf.disable_save_raw_in_XXX
1587  return (
1588  (is_video_recording() && conf.save_raw_in_video) || // True is movie mode and save_raw_in_video is disabled
1589 #ifdef CAM_HAS_CANON_RAW
1590  (shooting_get_canon_raw_enabled() && conf.save_raw_in_canon_raw) || // True if Canon RAW enabled, for cams that treat it as a resolution setting (g9, g10, s90, sx1? not g12, g1x)
1591 #endif
1592 #ifdef CAM_HAS_SPORTS_MODE
1593  ((m==MODE_SPORTS) && conf.save_raw_in_sports) || // True if sports mode and save_raw_in_sports is disabled
1594 #endif
1595  ((m==MODE_AUTO) && conf.save_raw_in_auto) || // True if auto mode and save_raw_in_auto is disabled
1596  (conf.edge_overlay_enable && conf.save_raw_in_edgeoverlay) || // True if edge overlay on and save_raw_in_edgeoverlay is disabled
1597  ((shooting_get_drive_mode()==1) && conf.save_raw_in_burst && !(m==MODE_SPORTS)) || // True if drive mode is continuous and save_raw_in_burst is disabled and not sports mode
1598  ((shooting_get_drive_mode()>=2) && conf.save_raw_in_timer) || // True if drive mode is timer and save_raw_in_timer is disabled
1599  ((shooting_get_prop(PROPCASE_BRACKET_MODE)==1) && conf.save_raw_in_ev_bracketing) // True if bracketing enabled and save_raw_in_ev_bracketing is disabled
1600  );
1601 }
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 }
unsigned int memhash31 ( unsigned char *  mem,
int  len 
)

Definiert in Zeile 963 der Datei conf.c.

964 {
965  unsigned hash=0;
966  for (; len > 0; mem++, len-- )
967  hash = *mem ^ (hash<<6) ^ (hash>>25);
968  return hash;
969 }
void osd_conf_info_func ( unsigned short  id)

Definiert in Zeile 343 der Datei conf.c.

344 {
345  switch (id)
346  {
347  case 6:
349  break;
350  case 131:
352  break;
353  case 132:
356  break;
357  case 135:
358  gui_lang_init();
359  break;
360  case 136:
362  break;
363 #if CAM_OPTIONAL_EXTRA_BUTTON
364  case 263:
366  break;
367 #endif
368  }
369 }
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 }
static int setValue ( ConfInfo ci,
unsigned short  id,
tConfigVal  configVal,
void(*)(unsigned short id)  info_func 
)
static

Definiert in Zeile 1476 der Datei conf.c.

1477 {
1478  int i;
1479  int ret = CONF_EMPTY, len, len2;
1480  OSD_pos* pos;
1481 
1482  // Don't allow scripts to enable Lua native calls.
1483  if (id == 999) return ret;
1484 
1485  i = findConfInfo(ci, id);
1486  if (i != -1)
1487  {
1488  switch( ci[i].type )
1489  {
1490  case CONF_VALUE:
1491  case CONF_FUNC_PTR:
1492  if( configVal.isNumb )
1493  {
1494  switch( ci[i].size )
1495  {
1496  case sizeof(int):
1497  *(int*)ci[i].var = (int)configVal.numb;
1498  ret = CONF_VALUE;
1499  break;
1500  case sizeof(short):
1501  *(short*)ci[i].var = (short)configVal.numb;
1502  ret = CONF_VALUE;
1503  break;
1504  case sizeof(char):
1505  *(char*)ci[i].var = (char)configVal.numb;
1506  ret = CONF_VALUE;
1507  break;
1508  }
1509  }
1510  break;
1511  case CONF_INT_PTR:
1512  if( configVal.isPInt )
1513  {
1514  len = ci[i].size;
1515  len2 = configVal.numb*sizeof(int);
1516  if( len2<len ) len = len2;
1517  memcpy(ci[i].var, configVal.pInt, len);
1518  ret = CONF_INT_PTR;
1519  }
1520  break;
1521  case CONF_CHAR_PTR:
1522  if( configVal.isStr )
1523  {
1524  len = strlen(configVal.str);
1525  if (len<CONF_STR_LEN)
1526  {
1527  strncpy(ci[i].var, configVal.str ,len+1);
1528  }
1529  ret = CONF_CHAR_PTR;
1530  }
1531  break;
1532  case CONF_OSD_POS:
1533  if( configVal.isPos )
1534  {
1535  pos = (OSD_pos*)ci[i].var;
1536  pos->x = configVal.pos.x;
1537  pos->y = configVal.pos.y;
1538  ret = CONF_OSD_POS;
1539  }
1540  break;
1541  }
1542  }
1543 
1544  if (ret != CONF_EMPTY)
1545  {
1546  // Perform an updates required on change of value
1547  if (info_func)
1548  info_func(id);
1549  // Save config file is autosave enabled
1550  if (config_autosave)
1551  conf_save();
1552  }
1553 
1554  return ret;
1555 }
void user_menu_conf_info_func ( unsigned short  id)

Definiert in Zeile 150 der Datei conf.c.

151 {
152  switch (id)
153  {
154  case 1:
156  break;
157  }
158 }

Variablen-Dokumentation

Conf conf

Definiert in Zeile 21 der Datei conf.c.

ConfInfo conf_info[]
static

Definiert in Zeile 371 der Datei conf.c.

short conf_map_1_2[]
static

Definiert in Zeile 654 der Datei conf.c.

int config_autosave = 1
static

Definiert in Zeile 1474 der Datei conf.c.

const confinfo_handler confinfo_handlers[]
static
const char* img_exts[NUM_IMG_EXTS] ={ ".JPG", ".CRW", ".CR2", ".THM", ".WAV"}

Definiert in Zeile 27 der Datei conf.c.

const char* img_folders[NUM_IMG_FOLDER_NAMES] ={ "A/DCIM", "withJPG", "A/RAW" }

Definiert in Zeile 25 der Datei conf.c.

const char* img_prefixes[NUM_IMG_PREFIXES] ={ "IMG_", "CRW_", "SND_" }

Definiert in Zeile 26 der Datei conf.c.

ConfInfo osd_conf_info[]
static

Definiert in Zeile 165 der Datei conf.c.

ConfInfo user_menu_conf_info[]
static
Initialisierung:

Definiert in Zeile 142 der Datei conf.c.