CHDK_DE Vorschauversion  Trunk Rev. 5842
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
conf.c-Dateireferenz
#include "platform.h"
#include "conf.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 reset_alt_button ()
 
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 165 der Datei conf.c.

#define COLOR_LAST_OVERRIDE   63

Definiert in Zeile 166 der Datei conf.c.

#define CONF_CORE   1000

Definiert in Zeile 631 der Datei conf.c.

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

Definiert in Zeile 636 der Datei conf.c.

#define CONF_GPS   4000

Definiert in Zeile 634 der Datei conf.c.

#define CONF_MAGICK_VALUE   (0x33204741)

Definiert in Zeile 640 der Datei conf.c.

#define CONF_OSD   2000

Definiert in Zeile 632 der Datei conf.c.

#define CONF_USER   3000

Definiert in Zeile 633 der Datei conf.c.

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

Definiert in Zeile 639 der Datei conf.c.

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

Definiert in Zeile 637 der Datei conf.c.

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

Definiert in Zeile 638 der Datei conf.c.

Dokumentation der Funktionen

void clear_values ( )

Definiert in Zeile 76 der Datei conf.c.

77 {
79 
80  if (conf.platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
81  {
82  conf.fast_ev = 0;
87 
88  // remote input channel - all cams assumed to support USB
89  // TODO could reset only if invalid on current cam
91 
92  // video related entries are interpreted differently on D6 cameras
93  conf.video_mode = 0;
97 #ifdef CAM_MOVIEREC_NEWSTYLE
99 #endif
100  }
101  if (conf.osd_platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
102  {
103  conf.zoom_scale = 100;
104  // battery voltages are camera dependent
108 
109  conf.mem_view_addr_init = 0x1000;
110 
111  }
112 
113  if (conf.clear_override)
114  {
120  }
121  if (conf.clear_bracket)
122  {
127  }
128  if (conf.clear_video)
129  {
130  conf.video_mode = 0;
131 #if CAM_CHDK_HAS_EXT_VIDEO_TIME
133 #endif
137 #ifdef CAM_MOVIEREC_NEWSTYLE
139 #endif
140  }
141  //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!
142 }
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_info_func ( unsigned short  id)

Definiert in Zeile 543 der Datei conf.c.

544 {
545  switch (id)
546  {
547  case 20:
548  case 36:
549  case 37:
550  conf_change_dng();
551  break;
552 #if defined (DNG_EXT_FROM)
553  case 38:
554  {
555  extern void save_ext_for_dng(void);
556  save_ext_for_dng();
557  cb_change_dng_usb_ext();
558  }
559  break;
560 #endif
561  case 54:
563  break;
564 #ifdef CAM_MOVIEREC_NEWSTYLE
565  case 81:
567  break;
568 #endif
569  case 82:
571  break;
572  case 200:
573  case 204:
574  case 205: // USB Remote
575  case 208:
577  break;
578  case 220:
580  break;
581  case 221:
583  break;
584  }
585 }
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  )
static int config_has_changed ( ConfInfo ci)
static

Definiert in Zeile 1011 der Datei conf.c.

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

Definiert in Zeile 1052 der Datei conf.c.

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

Definiert in Zeile 1251 der Datei conf.c.

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

Definiert in Zeile 978 der Datei conf.c.

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

Definiert in Zeile 1378 der Datei conf.c.

1379 {
1380  int i;
1381  for( i=0; ci[i].id > 0; ++i )
1382  if( ci[i].id==id )
1383  return i;
1384  return -1;
1385 }
static int getValue ( ConfInfo ci,
unsigned short  id,
tConfigVal configVal 
)
static

Definiert in Zeile 1404 der Datei conf.c.

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

Definiert in Zeile 1589 der Datei conf.c.

1589  {
1591  // NOTE: the conf.save_raw_in variables are negative logic
1592  // 1 = disable saving raw in this mode, 0 = allow saving raw
1593  // variables should be named conf.disable_save_raw_in_XXX
1594  return (
1595  (is_video_recording() && conf.save_raw_in_video) || // True is movie mode and save_raw_in_video is disabled
1596 #ifdef CAM_HAS_CANON_RAW
1597  ((shooting_get_canon_image_format() & SHOOTING_CANON_FMT_RAW) && 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)
1598 #endif
1599 #ifdef CAM_HAS_SPORTS_MODE
1600  ((m==MODE_SPORTS) && conf.save_raw_in_sports) || // True if sports mode and save_raw_in_sports is disabled
1601 #endif
1602  ((m==MODE_AUTO) && conf.save_raw_in_auto) || // True if auto mode and save_raw_in_auto is disabled
1603  (conf.edge_overlay_enable && conf.save_raw_in_edgeoverlay) || // True if edge overlay on and save_raw_in_edgeoverlay is disabled
1604  ((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
1605  ((shooting_get_drive_mode()>=2) && conf.save_raw_in_timer) || // True if drive mode is timer and save_raw_in_timer is disabled
1606  ((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
1607  );
1608 }
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 }
unsigned int memhash31 ( unsigned char *  mem,
int  len 
)

Definiert in Zeile 970 der Datei conf.c.

971 {
972  unsigned hash=0;
973  for (; len > 0; mem++, len-- )
974  hash = *mem ^ (hash<<6) ^ (hash>>25);
975  return hash;
976 }
void osd_conf_info_func ( unsigned short  id)

Definiert in Zeile 348 der Datei conf.c.

349 {
350  switch (id)
351  {
352  case 6:
354  break;
355  case 131:
357  break;
358  case 132:
361  break;
362  case 135:
363  gui_lang_init();
364  break;
365  case 136:
367  break;
368 #if CAM_OPTIONAL_EXTRA_BUTTON
369  case 263:
371  break;
372 #endif
373  }
374 }
void reset_alt_button ( )

Definiert in Zeile 66 der Datei conf.c.

67 {
68 #if CAM_ADJUSTABLE_ALT_BUTTON
69  extern const char* gui_alt_mode_button_enum(int change, int arg);
70  gui_alt_mode_button_enum(0,0); // will reset if not in list of valid alt buttons
71 #else
72  conf.alt_mode_button = CAM_DEFAULT_ALT_BUTTON; // if not adjustable, force to default
73 #endif
74 }
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 }
static int setValue ( ConfInfo ci,
unsigned short  id,
tConfigVal  configVal,
void(*)(unsigned short id)  info_func 
)
static

Definiert in Zeile 1483 der Datei conf.c.

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

Definiert in Zeile 153 der Datei conf.c.

154 {
155  switch (id)
156  {
157  case 1:
159  break;
160  }
161 }

Variablen-Dokumentation

Conf conf

Definiert in Zeile 20 der Datei conf.c.

ConfInfo conf_info[]
static

Definiert in Zeile 376 der Datei conf.c.

short conf_map_1_2[]
static

Definiert in Zeile 661 der Datei conf.c.

int config_autosave = 1
static

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

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

Definiert in Zeile 24 der Datei conf.c.

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

Definiert in Zeile 25 der Datei conf.c.

ConfInfo osd_conf_info[]
static

Definiert in Zeile 168 der Datei conf.c.

ConfInfo user_menu_conf_info[]
static
Initialisierung:

Definiert in Zeile 145 der Datei conf.c.