Skip to content

Commit

Permalink
Wifi marauder app critical bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Aug 17, 2022
1 parent 077898f commit 9b5486c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
app->text_box_store_strlen += len;
if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
string_right(app->text_box_store, app->text_box_store_strlen / 2);
app->text_box_store_strlen = string_size(app->text_box_store);
app->text_box_store_strlen = string_size(app->text_box_store) + len;
}

// Null-terminate buf and append to text box store
Expand Down Expand Up @@ -44,10 +44,11 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
string_cat_str(app->text_box_store, help_msg);
app->text_box_store_strlen += strlen(help_msg);
}
} else { // "View Log" menu action
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
}

// Set starting text - for "View Log", this will just be what was already in the text box store
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));

scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneConsoleOutput, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef struct {

// NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
const WifiMarauderItem items[NUM_MENU_ITEMS] = {
{"View Log from", {"start", "end"}, 2, {}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP},
{"View Log from", {"start", "end"}, 2, {"", ""}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP},
{"Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP},
{"SSID",
{"add random", "add name", "remove"},
Expand Down Expand Up @@ -96,20 +96,23 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uint32_t index) {
furi_assert(context);
WifiMarauderApp* app = context;
if(app->selected_option_index[index] < items[index].num_options_menu) {
app->selected_tx_string = items[index].actual_commands[app->selected_option_index[index]];
}

furi_assert(index < NUM_MENU_ITEMS);
const WifiMarauderItem* item = &items[index];

const int selected_option_index = app->selected_option_index[index];
furi_assert(selected_option_index < item->num_options_menu);
app->selected_tx_string = item->actual_commands[selected_option_index];
app->is_command = (1 <= index);
app->is_custom_tx_string = false;
app->selected_menu_index = index;
app->focus_console_start = (items[index].focus_console == FOCUS_CONSOLE_TOGGLE) ?
(app->selected_option_index[index] == 0) :
items[index].focus_console;
app->show_stopscan_tip = items[index].show_stopscan_tip;

bool needs_keyboard = (items[index].needs_keyboard == TOGGLE_ARGS) ?
(app->selected_option_index[index] != 0) :
items[index].needs_keyboard;
app->focus_console_start = (item->focus_console == FOCUS_CONSOLE_TOGGLE) ?
(selected_option_index == 0) :
item->focus_console;
app->show_stopscan_tip = item->show_stopscan_tip;

bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS) ? (selected_option_index != 0) :
item->needs_keyboard;
if(needs_keyboard) {
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartKeyboard);
} else {
Expand Down Expand Up @@ -145,11 +148,9 @@ void wifi_marauder_scene_start_on_enter(void* context) {
items[i].num_options_menu,
wifi_marauder_scene_start_var_list_change_callback,
app);
if(items[i].num_options_menu) {
variable_item_set_current_value_index(item, app->selected_option_index[i]);
variable_item_set_current_value_text(
item, items[i].options_menu[app->selected_option_index[i]]);
}
variable_item_set_current_value_index(item, app->selected_option_index[i]);
variable_item_set_current_value_text(
item, items[i].options_menu[app->selected_option_index[i]]);
}

variable_item_list_set_selected_item(
Expand Down

0 comments on commit 9b5486c

Please sign in to comment.