rename global session
This commit is contained in:
1 parent
6a2f2b3979
commit
dd3b63ae32
20 files changed
+258
-258
No files matched your search
+111
-111
@@ -11,8 +11,8 @@
|
||||
// Add the default value for the setting in the settings_load page below
|
||||
// Update the preferences_load_callback to load your setting into the stucture
|
||||
// Update the preferences_save_callback to ensure your setting gets saved when needed.
|
||||
// use the preference as needed : session.<preference name>
|
||||
// Can use (session.preferences_loaded) to check if json settings file was used
|
||||
// use the preference as needed : g_session.<preference name>
|
||||
// Can use (g_session.preferences_loaded) to check if json settings file was used
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "preferences.h"
|
||||
@@ -40,21 +40,21 @@ static char *prefGetFilename(void) {
|
||||
int preferences_load(void) {
|
||||
|
||||
// Set all defaults
|
||||
session.client_debug_level = cdbOFF;
|
||||
// session.device_debug_level = ddbOFF;
|
||||
session.window_changed = false;
|
||||
session.plot.x = 10;
|
||||
session.plot.y = 30;
|
||||
session.plot.h = 400;
|
||||
session.plot.w = 800;
|
||||
session.overlay.x = session.plot.x;
|
||||
session.overlay.y = 60 + session.plot.y + session.plot.h;
|
||||
session.overlay.h = 200;
|
||||
session.overlay.w = session.plot.w;
|
||||
session.overlay_sliders = true;
|
||||
session.show_hints = true;
|
||||
g_session.client_debug_level = cdbOFF;
|
||||
// g_session.device_debug_level = ddbOFF;
|
||||
g_session.window_changed = false;
|
||||
g_session.plot.x = 10;
|
||||
g_session.plot.y = 30;
|
||||
g_session.plot.h = 400;
|
||||
g_session.plot.w = 800;
|
||||
g_session.overlay.x = g_session.plot.x;
|
||||
g_session.overlay.y = 60 + g_session.plot.y + g_session.plot.h;
|
||||
g_session.overlay.h = 200;
|
||||
g_session.overlay.w = g_session.plot.w;
|
||||
g_session.overlay_sliders = true;
|
||||
g_session.show_hints = true;
|
||||
|
||||
session.bar_mode = STYLE_VALUE;
|
||||
g_session.bar_mode = STYLE_VALUE;
|
||||
setDefaultPath(spDefault, "");
|
||||
setDefaultPath(spDump, "");
|
||||
setDefaultPath(spTrace, "");
|
||||
@@ -77,7 +77,7 @@ int preferences_load(void) {
|
||||
else
|
||||
setDefaultPath(spTrace, ".");
|
||||
|
||||
if (session.incognito) {
|
||||
if (g_session.incognito) {
|
||||
PrintAndLogEx(INFO, "No preferences file will be loaded");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -91,11 +91,11 @@ int preferences_load(void) {
|
||||
char *fn = prefGetFilename();
|
||||
if (fileExists(fn)) {
|
||||
if (loadFileJSON(fn, &dummyData, sizeof(dummyData), &dummyDL, &preferences_load_callback) == PM3_SUCCESS) {
|
||||
session.preferences_loaded = true;
|
||||
g_session.preferences_loaded = true;
|
||||
}
|
||||
}
|
||||
free(fn);
|
||||
// Note, if session.settings_loaded == false then the settings_save
|
||||
// Note, if g_session.settings_loaded == false then the settings_save
|
||||
// will be called in main () to save settings as set in defaults and main() checks.
|
||||
|
||||
return PM3_SUCCESS;
|
||||
@@ -104,7 +104,7 @@ int preferences_load(void) {
|
||||
// Save all settings from memory (struct) to file
|
||||
int preferences_save(void) {
|
||||
// Note sure if backup has value ?
|
||||
if (session.incognito) {
|
||||
if (g_session.incognito) {
|
||||
PrintAndLogEx(INFO, "No preferences file will be saved");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void preferences_save_callback(json_t *root) {
|
||||
JsonSaveStr(root, "FileType", "settings");
|
||||
|
||||
// Emoji
|
||||
switch (session.emoji_mode) {
|
||||
switch (g_session.emoji_mode) {
|
||||
case EMO_ALIAS:
|
||||
JsonSaveStr(root, "show.emoji", "alias");
|
||||
break;
|
||||
@@ -173,29 +173,29 @@ void preferences_save_callback(json_t *root) {
|
||||
JsonSaveStr(root, "show.emoji", "ALIAS");
|
||||
}
|
||||
|
||||
JsonSaveBoolean(root, "show.hints", session.show_hints);
|
||||
JsonSaveBoolean(root, "show.hints", g_session.show_hints);
|
||||
|
||||
JsonSaveBoolean(root, "os.supports.colors", session.supports_colors);
|
||||
JsonSaveBoolean(root, "os.supports.colors", g_session.supports_colors);
|
||||
|
||||
JsonSaveStr(root, "file.default.savepath", session.defaultPaths[spDefault]);
|
||||
JsonSaveStr(root, "file.default.dumppath", session.defaultPaths[spDump]);
|
||||
JsonSaveStr(root, "file.default.tracepath", session.defaultPaths[spTrace]);
|
||||
JsonSaveStr(root, "file.default.savepath", g_session.defaultPaths[spDefault]);
|
||||
JsonSaveStr(root, "file.default.dumppath", g_session.defaultPaths[spDump]);
|
||||
JsonSaveStr(root, "file.default.tracepath", g_session.defaultPaths[spTrace]);
|
||||
|
||||
// Plot window
|
||||
JsonSaveInt(root, "window.plot.xpos", session.plot.x);
|
||||
JsonSaveInt(root, "window.plot.ypos", session.plot.y);
|
||||
JsonSaveInt(root, "window.plot.hsize", session.plot.h);
|
||||
JsonSaveInt(root, "window.plot.wsize", session.plot.w);
|
||||
JsonSaveInt(root, "window.plot.xpos", g_session.plot.x);
|
||||
JsonSaveInt(root, "window.plot.ypos", g_session.plot.y);
|
||||
JsonSaveInt(root, "window.plot.hsize", g_session.plot.h);
|
||||
JsonSaveInt(root, "window.plot.wsize", g_session.plot.w);
|
||||
|
||||
// Overlay/Slider window
|
||||
JsonSaveInt(root, "window.overlay.xpos", session.overlay.x);
|
||||
JsonSaveInt(root, "window.overlay.ypos", session.overlay.y);
|
||||
JsonSaveInt(root, "window.overlay.hsize", session.overlay.h);
|
||||
JsonSaveInt(root, "window.overlay.wsize", session.overlay.w);
|
||||
JsonSaveBoolean(root, "window.overlay.sliders", session.overlay_sliders);
|
||||
JsonSaveInt(root, "window.overlay.xpos", g_session.overlay.x);
|
||||
JsonSaveInt(root, "window.overlay.ypos", g_session.overlay.y);
|
||||
JsonSaveInt(root, "window.overlay.hsize", g_session.overlay.h);
|
||||
JsonSaveInt(root, "window.overlay.wsize", g_session.overlay.w);
|
||||
JsonSaveBoolean(root, "window.overlay.sliders", g_session.overlay_sliders);
|
||||
|
||||
// Log level, convert to text
|
||||
switch (session.client_debug_level) {
|
||||
switch (g_session.client_debug_level) {
|
||||
case cdbOFF:
|
||||
JsonSaveStr(root, "client.debug.level", "off");
|
||||
break;
|
||||
@@ -209,7 +209,7 @@ void preferences_save_callback(json_t *root) {
|
||||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
|
||||
switch (session.bar_mode) {
|
||||
switch (g_session.bar_mode) {
|
||||
case STYLE_BAR:
|
||||
JsonSaveStr(root, "show.bar.mode", "bar");
|
||||
break;
|
||||
@@ -223,7 +223,7 @@ void preferences_save_callback(json_t *root) {
|
||||
JsonSaveStr(root, "show.bar.mode", "value");
|
||||
}
|
||||
/*
|
||||
switch (session.device_debug_level) {
|
||||
switch (g_session.device_debug_level) {
|
||||
case ddbOFF:
|
||||
JsonSaveStr(root, "device.debug.level", "off");
|
||||
break;
|
||||
@@ -243,7 +243,7 @@ void preferences_save_callback(json_t *root) {
|
||||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
*/
|
||||
JsonSaveInt(root, "client.exe.delay", session.client_exe_delay);
|
||||
JsonSaveInt(root, "client.exe.delay", g_session.client_exe_delay);
|
||||
|
||||
}
|
||||
void preferences_load_callback(json_t *root) {
|
||||
@@ -257,9 +257,9 @@ void preferences_load_callback(json_t *root) {
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "client.debug.level", &s1) == 0) {
|
||||
strncpy(tempStr, s1, sizeof(tempStr) - 1);
|
||||
str_lower(tempStr);
|
||||
if (strncmp(tempStr, "off", 3) == 0) session.client_debug_level = cdbOFF;
|
||||
if (strncmp(tempStr, "simple", 6) == 0) session.client_debug_level = cdbSIMPLE;
|
||||
if (strncmp(tempStr, "full", 4) == 0) session.client_debug_level = cdbFULL;
|
||||
if (strncmp(tempStr, "off", 3) == 0) g_session.client_debug_level = cdbOFF;
|
||||
if (strncmp(tempStr, "simple", 6) == 0) g_session.client_debug_level = cdbSIMPLE;
|
||||
if (strncmp(tempStr, "full", 4) == 0) g_session.client_debug_level = cdbFULL;
|
||||
}
|
||||
|
||||
// default save path
|
||||
@@ -276,49 +276,49 @@ void preferences_load_callback(json_t *root) {
|
||||
|
||||
// window plot
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.xpos", &i1) == 0)
|
||||
session.plot.x = i1;
|
||||
g_session.plot.x = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.ypos", &i1) == 0)
|
||||
session.plot.y = i1;
|
||||
g_session.plot.y = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.hsize", &i1) == 0)
|
||||
session.plot.h = i1;
|
||||
g_session.plot.h = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.plot.wsize", &i1) == 0)
|
||||
session.plot.w = i1;
|
||||
g_session.plot.w = i1;
|
||||
|
||||
// overlay/slider plot
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.overlay.xpos", &i1) == 0)
|
||||
session.overlay.x = i1;
|
||||
g_session.overlay.x = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.overlay.ypos", &i1) == 0)
|
||||
session.overlay.y = i1;
|
||||
g_session.overlay.y = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.overlay.hsize", &i1) == 0)
|
||||
session.overlay.h = i1;
|
||||
g_session.overlay.h = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "window.overlay.wsize", &i1) == 0)
|
||||
session.overlay.w = i1;
|
||||
g_session.overlay.w = i1;
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:b}", "window.overlay.sliders", &b1) == 0)
|
||||
session.overlay_sliders = (bool)b1;
|
||||
g_session.overlay_sliders = (bool)b1;
|
||||
|
||||
// show options
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "show.emoji", &s1) == 0) {
|
||||
strncpy(tempStr, s1, sizeof(tempStr) - 1);
|
||||
str_lower(tempStr);
|
||||
if (strncmp(tempStr, "alias", 5) == 0) session.emoji_mode = EMO_ALIAS;
|
||||
if (strncmp(tempStr, "emoji", 5) == 0) session.emoji_mode = EMO_EMOJI;
|
||||
if (strncmp(tempStr, "alttext", 7) == 0) session.emoji_mode = EMO_ALTTEXT;
|
||||
if (strncmp(tempStr, "none", 4) == 0) session.emoji_mode = EMO_NONE;
|
||||
if (strncmp(tempStr, "alias", 5) == 0) g_session.emoji_mode = EMO_ALIAS;
|
||||
if (strncmp(tempStr, "emoji", 5) == 0) g_session.emoji_mode = EMO_EMOJI;
|
||||
if (strncmp(tempStr, "alttext", 7) == 0) g_session.emoji_mode = EMO_ALTTEXT;
|
||||
if (strncmp(tempStr, "none", 4) == 0) g_session.emoji_mode = EMO_NONE;
|
||||
}
|
||||
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:b}", "show.hints", &b1) == 0)
|
||||
session.show_hints = (bool)b1;
|
||||
g_session.show_hints = (bool)b1;
|
||||
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:b}", "os.supports.colors", &b1) == 0)
|
||||
session.supports_colors = (bool)b1;
|
||||
g_session.supports_colors = (bool)b1;
|
||||
|
||||
// bar mode
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "show.bar.mode", &s1) == 0) {
|
||||
strncpy(tempStr, s1, sizeof(tempStr) - 1);
|
||||
str_lower(tempStr);
|
||||
if (strncmp(tempStr, "bar", 5) == 0) session.bar_mode = STYLE_BAR;
|
||||
if (strncmp(tempStr, "mixed", 5) == 0) session.bar_mode = STYLE_MIXED;
|
||||
if (strncmp(tempStr, "value", 7) == 0) session.bar_mode = STYLE_VALUE;
|
||||
if (strncmp(tempStr, "bar", 5) == 0) g_session.bar_mode = STYLE_BAR;
|
||||
if (strncmp(tempStr, "mixed", 5) == 0) g_session.bar_mode = STYLE_MIXED;
|
||||
if (strncmp(tempStr, "value", 7) == 0) g_session.bar_mode = STYLE_VALUE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -326,16 +326,16 @@ void preferences_load_callback(json_t *root) {
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:s}", "device.debug.level", &s1) == 0) {
|
||||
strncpy(tempStr, s1, sizeof(tempStr) - 1);
|
||||
str_lower(tempStr);
|
||||
if (strncmp(tempStr, "off", 3) == 0) session.device_debug_level = ddbOFF;
|
||||
if (strncmp(tempStr, "error", 5) == 0) session.device_debug_level = ddbERROR;
|
||||
if (strncmp(tempStr, "info", 4) == 0) session.device_debug_level = ddbINFO;
|
||||
if (strncmp(tempStr, "debug", 5) == 0) session.device_debug_level = ddbDEBUG;
|
||||
if (strncmp(tempStr, "extended", 8) == 0) session.device_debug_level = ddbEXTENDED;
|
||||
if (strncmp(tempStr, "off", 3) == 0) g_session.device_debug_level = ddbOFF;
|
||||
if (strncmp(tempStr, "error", 5) == 0) g_session.device_debug_level = ddbERROR;
|
||||
if (strncmp(tempStr, "info", 4) == 0) g_session.device_debug_level = ddbINFO;
|
||||
if (strncmp(tempStr, "debug", 5) == 0) g_session.device_debug_level = ddbDEBUG;
|
||||
if (strncmp(tempStr, "extended", 8) == 0) g_session.device_debug_level = ddbEXTENDED;
|
||||
}
|
||||
*/
|
||||
// client command execution delay
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "client.exe.delay", &i1) == 0)
|
||||
session.client_exe_delay = i1;
|
||||
g_session.client_exe_delay = i1;
|
||||
}
|
||||
|
||||
// Help Functions
|
||||
@@ -358,7 +358,7 @@ static const char *prefShowMsg(prefShowOpt_t Opt) {
|
||||
|
||||
static void showEmojiState(prefShowOpt_t opt) {
|
||||
|
||||
switch (session.emoji_mode) {
|
||||
switch (g_session.emoji_mode) {
|
||||
case EMO_ALIAS:
|
||||
PrintAndLogEx(INFO, " %s emoji.................. "_GREEN_("alias"), prefShowMsg(opt));
|
||||
break;
|
||||
@@ -378,7 +378,7 @@ static void showEmojiState(prefShowOpt_t opt) {
|
||||
|
||||
static void showColorState(prefShowOpt_t opt) {
|
||||
|
||||
if (session.supports_colors)
|
||||
if (g_session.supports_colors)
|
||||
PrintAndLogEx(INFO, " %s color.................. "_GREEN_("ansi"), prefShowMsg(opt));
|
||||
else
|
||||
PrintAndLogEx(INFO, " %s color.................. "_WHITE_("off"), prefShowMsg(opt));
|
||||
@@ -386,7 +386,7 @@ static void showColorState(prefShowOpt_t opt) {
|
||||
|
||||
static void showClientDebugState(prefShowOpt_t opt) {
|
||||
|
||||
switch (session.client_debug_level) {
|
||||
switch (g_session.client_debug_level) {
|
||||
case cdbOFF:
|
||||
PrintAndLogEx(INFO, " %s client debug........... "_WHITE_("off"), prefShowMsg(opt));
|
||||
break;
|
||||
@@ -402,7 +402,7 @@ static void showClientDebugState(prefShowOpt_t opt) {
|
||||
}
|
||||
/*
|
||||
static void showDeviceDebugState(prefShowOpt_t opt) {
|
||||
switch (session.device_debug_level) {
|
||||
switch (g_session.device_debug_level) {
|
||||
case ddbOFF:
|
||||
PrintAndLogEx(INFO, " %s device debug........... "_WHITE_("off"), prefShowMsg(opt));
|
||||
break;
|
||||
@@ -443,7 +443,7 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
|
||||
}
|
||||
|
||||
if (path_index < spItemCount) {
|
||||
if ((session.defaultPaths[path_index] == NULL) || (strcmp(session.defaultPaths[path_index], "") == 0)) {
|
||||
if ((g_session.defaultPaths[path_index] == NULL) || (strcmp(g_session.defaultPaths[path_index], "") == 0)) {
|
||||
PrintAndLogEx(INFO, " %s %s "_WHITE_("not set"),
|
||||
prefShowMsg(opt),
|
||||
s
|
||||
@@ -452,7 +452,7 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
|
||||
PrintAndLogEx(INFO, " %s %s "_GREEN_("%s"),
|
||||
prefShowMsg(opt),
|
||||
s,
|
||||
session.defaultPaths[path_index]
|
||||
g_session.defaultPaths[path_index]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -460,31 +460,31 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
|
||||
|
||||
static void showPlotPosState(void) {
|
||||
PrintAndLogEx(INFO, " Plot window............ X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||
session.plot.x,
|
||||
session.plot.y,
|
||||
session.plot.h,
|
||||
session.plot.w
|
||||
g_session.plot.x,
|
||||
g_session.plot.y,
|
||||
g_session.plot.h,
|
||||
g_session.plot.w
|
||||
);
|
||||
}
|
||||
|
||||
static void showOverlayPosState(void) {
|
||||
PrintAndLogEx(INFO, " Slider/Overlay window.. X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||
session.overlay.x,
|
||||
session.overlay.y,
|
||||
session.overlay.h,
|
||||
session.overlay.w
|
||||
g_session.overlay.x,
|
||||
g_session.overlay.y,
|
||||
g_session.overlay.h,
|
||||
g_session.overlay.w
|
||||
);
|
||||
}
|
||||
|
||||
static void showHintsState(prefShowOpt_t opt) {
|
||||
if (session.show_hints)
|
||||
if (g_session.show_hints)
|
||||
PrintAndLogEx(INFO, " %s hints.................. "_GREEN_("on"), prefShowMsg(opt));
|
||||
else
|
||||
PrintAndLogEx(INFO, " %s hints.................. "_WHITE_("off"), prefShowMsg(opt));
|
||||
}
|
||||
|
||||
static void showPlotSliderState(prefShowOpt_t opt) {
|
||||
if (session.overlay_sliders)
|
||||
if (g_session.overlay_sliders)
|
||||
PrintAndLogEx(INFO, " %s show plot sliders...... "_GREEN_("on"), prefShowMsg(opt));
|
||||
else
|
||||
PrintAndLogEx(INFO, " %s show plot sliders...... "_WHITE_("off"), prefShowMsg(opt));
|
||||
@@ -492,7 +492,7 @@ static void showPlotSliderState(prefShowOpt_t opt) {
|
||||
|
||||
static void showBarModeState(prefShowOpt_t opt) {
|
||||
|
||||
switch (session.bar_mode) {
|
||||
switch (g_session.bar_mode) {
|
||||
case STYLE_BAR:
|
||||
PrintAndLogEx(INFO, " %s barmode................ "_GREEN_("bar"), prefShowMsg(opt));
|
||||
break;
|
||||
@@ -508,7 +508,7 @@ static void showBarModeState(prefShowOpt_t opt) {
|
||||
}
|
||||
|
||||
static void showClientExeDelayState(void) {
|
||||
PrintAndLogEx(INFO, " Cmd execution delay.... "_GREEN_("%u"), session.client_exe_delay);
|
||||
PrintAndLogEx(INFO, " Cmd execution delay.... "_GREEN_("%u"), g_session.client_exe_delay);
|
||||
}
|
||||
|
||||
|
||||
@@ -539,7 +539,7 @@ static int setCmdEmoji(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
emojiMode_t new_value = session.emoji_mode;
|
||||
emojiMode_t new_value = g_session.emoji_mode;
|
||||
|
||||
if (show_a) {
|
||||
new_value = EMO_ALIAS;
|
||||
@@ -554,9 +554,9 @@ static int setCmdEmoji(const char *Cmd) {
|
||||
new_value = EMO_NONE;
|
||||
}
|
||||
|
||||
if (session.emoji_mode != new_value) {// changed
|
||||
if (g_session.emoji_mode != new_value) {// changed
|
||||
showEmojiState(prefShowOLD);
|
||||
session.emoji_mode = new_value;
|
||||
g_session.emoji_mode = new_value;
|
||||
showEmojiState(prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -589,7 +589,7 @@ static int setCmdColor(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool new_value = session.supports_colors;
|
||||
bool new_value = g_session.supports_colors;
|
||||
if (use_c) {
|
||||
new_value = true;
|
||||
}
|
||||
@@ -598,9 +598,9 @@ static int setCmdColor(const char *Cmd) {
|
||||
new_value = false;
|
||||
}
|
||||
|
||||
if (session.supports_colors != new_value) {
|
||||
if (g_session.supports_colors != new_value) {
|
||||
showColorState(prefShowOLD);
|
||||
session.supports_colors = new_value;
|
||||
g_session.supports_colors = new_value;
|
||||
showColorState(prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -635,7 +635,7 @@ static int setCmdDebug(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
clientdebugLevel_t new_value = session.client_debug_level;
|
||||
clientdebugLevel_t new_value = g_session.client_debug_level;
|
||||
|
||||
if (use_off) {
|
||||
new_value = cdbOFF;
|
||||
@@ -647,9 +647,9 @@ static int setCmdDebug(const char *Cmd) {
|
||||
new_value = cdbFULL;
|
||||
}
|
||||
|
||||
if (session.client_debug_level != new_value) {
|
||||
if (g_session.client_debug_level != new_value) {
|
||||
showClientDebugState(prefShowOLD);
|
||||
session.client_debug_level = new_value;
|
||||
g_session.client_debug_level = new_value;
|
||||
g_debugMode = new_value;
|
||||
showClientDebugState(prefShowNEW);
|
||||
preferences_save();
|
||||
@@ -690,7 +690,7 @@ static int setCmdDeviceDebug (const char *Cmd)
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
devicedebugLevel_t new_value = session.device_debug_level;
|
||||
devicedebugLevel_t new_value = g_session.device_debug_level;
|
||||
|
||||
if (use_off) {
|
||||
new_value = ddbOFF;
|
||||
@@ -708,18 +708,18 @@ static int setCmdDeviceDebug (const char *Cmd)
|
||||
new_value = ddbEXTENDED;
|
||||
}
|
||||
|
||||
if (session.device_debug_level != new_value) {// changed
|
||||
if (g_session.device_debug_level != new_value) {// changed
|
||||
showDeviceDebugState (prefShowOLD);
|
||||
session.device_debug_level = new_value;
|
||||
g_session.device_debug_level = new_value;
|
||||
showDeviceDebugState (prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
showDeviceDebugState (prefShowNone);
|
||||
}
|
||||
|
||||
if (session.pm3_present) {
|
||||
if (g_session.pm3_present) {
|
||||
PrintAndLogEx (INFO,"setting device debug loglevel");
|
||||
SendCommandNG(CMD_SET_DBGMODE, &session.device_debug_level, 1);
|
||||
SendCommandNG(CMD_SET_DBGMODE, &g_session.device_debug_level, 1);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_SET_DBGMODE, &resp, 2000) == false)
|
||||
PrintAndLogEx (WARNING,"failed to set device debug loglevel");
|
||||
@@ -746,9 +746,9 @@ static int setCmdExeDelay(const char *Cmd) {
|
||||
uint16_t new_value = (uint16_t)arg_get_int_def(ctx, 1, 0);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (session.client_exe_delay != new_value) {
|
||||
if (g_session.client_exe_delay != new_value) {
|
||||
showClientExeDelayState();
|
||||
session.client_exe_delay = new_value;
|
||||
g_session.client_exe_delay = new_value;
|
||||
showClientExeDelayState();
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -780,7 +780,7 @@ static int setCmdHint(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool new_value = session.show_hints;
|
||||
bool new_value = g_session.show_hints;
|
||||
if (use_off) {
|
||||
new_value = false;
|
||||
}
|
||||
@@ -788,9 +788,9 @@ static int setCmdHint(const char *Cmd) {
|
||||
new_value = true;
|
||||
}
|
||||
|
||||
if (session.show_hints != new_value) {
|
||||
if (g_session.show_hints != new_value) {
|
||||
showHintsState(prefShowOLD);
|
||||
session.show_hints = new_value;
|
||||
g_session.show_hints = new_value;
|
||||
showHintsState(prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -823,7 +823,7 @@ static int setCmdPlotSliders(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool new_value = session.overlay_sliders;
|
||||
bool new_value = g_session.overlay_sliders;
|
||||
if (use_off) {
|
||||
new_value = false;
|
||||
}
|
||||
@@ -831,9 +831,9 @@ static int setCmdPlotSliders(const char *Cmd) {
|
||||
new_value = true;
|
||||
}
|
||||
|
||||
if (session.overlay_sliders != new_value) {
|
||||
if (g_session.overlay_sliders != new_value) {
|
||||
showPlotSliderState(prefShowOLD);
|
||||
session.overlay_sliders = new_value;
|
||||
g_session.overlay_sliders = new_value;
|
||||
showPlotSliderState(prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -910,7 +910,7 @@ static int setCmdSavePaths(const char *Cmd) {
|
||||
// create_path (newValue); //mkdir (newValue,0x777);
|
||||
|
||||
if (path_item < spItemCount) {
|
||||
if (strcmp(path, session.defaultPaths[path_item]) != 0) {
|
||||
if (strcmp(path, g_session.defaultPaths[path_item]) != 0) {
|
||||
showSavePathState(path_item, prefShowOLD);
|
||||
setDefaultPath(path_item, path);
|
||||
showSavePathState(path_item, prefShowNEW);
|
||||
@@ -948,7 +948,7 @@ static int setCmdBarMode(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
barMode_t new_value = session.bar_mode;
|
||||
barMode_t new_value = g_session.bar_mode;
|
||||
if (show_bar) {
|
||||
new_value = STYLE_BAR;
|
||||
}
|
||||
@@ -959,9 +959,9 @@ static int setCmdBarMode(const char *Cmd) {
|
||||
new_value = STYLE_VALUE;
|
||||
}
|
||||
|
||||
if (session.bar_mode != new_value) {
|
||||
if (g_session.bar_mode != new_value) {
|
||||
showBarModeState(prefShowOLD);
|
||||
session.bar_mode = new_value;
|
||||
g_session.bar_mode = new_value;
|
||||
showBarModeState(prefShowNEW);
|
||||
preferences_save();
|
||||
} else {
|
||||
@@ -1156,7 +1156,7 @@ static int CmdPrefShow(const char *Cmd) {
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (session.preferences_loaded) {
|
||||
if (g_session.preferences_loaded) {
|
||||
char *fn = prefGetFilename();
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "Using "_YELLOW_("%s"), fn);
|
||||
|
||||
Reference in new issue
Block a user