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

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

Definiert in Zeile 631 der Datei conf.c.

#define CONF_GPS   4000

Definiert in Zeile 629 der Datei conf.c.

#define CONF_MAGICK_VALUE   (0x33204741)

Definiert in Zeile 635 der Datei conf.c.

#define CONF_OSD   2000

Definiert in Zeile 627 der Datei conf.c.

#define CONF_USER   3000

Definiert in Zeile 628 der Datei conf.c.

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

Definiert in Zeile 634 der Datei conf.c.

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

Definiert in Zeile 632 der Datei conf.c.

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

Definiert in Zeile 633 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 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_info_func ( unsigned short  id)

Definiert in Zeile 536 der Datei conf.c.

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

Definiert in Zeile 1006 der Datei conf.c.

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

Definiert in Zeile 1047 der Datei conf.c.

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

Definiert in Zeile 1246 der Datei conf.c.

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

Definiert in Zeile 973 der Datei conf.c.

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

Definiert in Zeile 1373 der Datei conf.c.

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

Definiert in Zeile 1399 der Datei conf.c.

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

Definiert in Zeile 1584 der Datei conf.c.

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

Definiert in Zeile 965 der Datei conf.c.

966 {
967  unsigned hash=0;
968  for (; len > 0; mem++, len-- )
969  hash = *mem ^ (hash<<6) ^ (hash>>25);
970  return hash;
971 }
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 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 }
static int setValue ( ConfInfo ci,
unsigned short  id,
tConfigVal  configVal,
void(*)(unsigned short id)  info_func 
)
static

Definiert in Zeile 1478 der Datei conf.c.

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

int config_autosave = 1
static

Definiert in Zeile 1476 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.