CHDK_DE Vorschauversion  Trunk Rev. 5579
 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 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 161 der Datei conf.c.

#define COLOR_LAST_OVERRIDE   63

Definiert in Zeile 162 der Datei conf.c.

#define CONF_CORE   1000

Definiert in Zeile 629 der Datei conf.c.

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

Definiert in Zeile 634 der Datei conf.c.

#define CONF_GPS   4000

Definiert in Zeile 632 der Datei conf.c.

#define CONF_MAGICK_VALUE   (0x33204741)

Definiert in Zeile 638 der Datei conf.c.

#define CONF_OSD   2000

Definiert in Zeile 630 der Datei conf.c.

#define CONF_USER   3000

Definiert in Zeile 631 der Datei conf.c.

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

Definiert in Zeile 637 der Datei conf.c.

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

Definiert in Zeile 635 der Datei conf.c.

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

Definiert in Zeile 636 der Datei conf.c.

Dokumentation der Funktionen

void clear_values ( )

Definiert in Zeile 66 der Datei conf.c.

67 {
68 
69 #if CAM_ADJUSTABLE_ALT_BUTTON
70  extern const char* gui_alt_mode_button_enum(int change, int arg);
71  gui_alt_mode_button_enum(0,0); // will reset if not in list of valid alt buttons
72 #else
73  conf.alt_mode_button = CAM_DEFAULT_ALT_BUTTON; // if not adjustable, force to default
74 #endif
75 
76  if (conf.platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
77  {
78  conf.fast_ev = 0;
83 
84  // remote input channel - all cams assumed to support USB
85  // TODO could reset only if invalid on current cam
87 
88  // video related entries are interpreted differently on D6 cameras
89  conf.video_mode = 0;
93 #ifdef CAM_MOVIEREC_NEWSTYLE
95 #endif
96  }
97  if (conf.osd_platformid != PLATFORMID) // the following config entries will be resetted if you switch the camera using the same cfg
98  {
99  conf.zoom_scale = 100;
100  // battery voltages are camera dependent
104 
105  conf.mem_view_addr_init = 0x1000;
106 
107  }
108 
109  if (conf.clear_override)
110  {
116  }
117  if (conf.clear_bracket)
118  {
123  }
124  if (conf.clear_video)
125  {
126  conf.video_mode = 0;
127 #if CAM_CHDK_HAS_EXT_VIDEO_TIME
129 #endif
133 #ifdef CAM_MOVIEREC_NEWSTYLE
135 #endif
136  }
137  //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!
138 }
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_info_func ( unsigned short  id)

Definiert in Zeile 539 der Datei conf.c.

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

Definiert in Zeile 1009 der Datei conf.c.

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

Definiert in Zeile 1050 der Datei conf.c.

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

Definiert in Zeile 1249 der Datei conf.c.

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

Definiert in Zeile 976 der Datei conf.c.

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

Definiert in Zeile 1376 der Datei conf.c.

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

Definiert in Zeile 1402 der Datei conf.c.

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

Definiert in Zeile 1587 der Datei conf.c.

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

Definiert in Zeile 968 der Datei conf.c.

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

Definiert in Zeile 344 der Datei conf.c.

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

Definiert in Zeile 1481 der Datei conf.c.

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

Definiert in Zeile 149 der Datei conf.c.

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

Variablen-Dokumentation

Conf conf

Definiert in Zeile 20 der Datei conf.c.

ConfInfo conf_info[]
static

Definiert in Zeile 372 der Datei conf.c.

short conf_map_1_2[]
static

Definiert in Zeile 659 der Datei conf.c.

int config_autosave = 1
static

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

ConfInfo user_menu_conf_info[]
static
Initialisierung:

Definiert in Zeile 141 der Datei conf.c.