mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-30 08:20:21 +00:00
rise and shine mr freeman...
This commit is contained in:
parent
b0c9af9c06
commit
45840a1146
10 changed files with 135 additions and 120 deletions
|
@ -372,24 +372,28 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||||
}
|
}
|
||||||
if(event->key == InputKeyUp || event->key == InputKeyDown) {
|
if(event->key == InputKeyUp || event->key == InputKeyDown) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
browser->view, (ArchiveBrowserViewModel * model) {
|
browser->view,
|
||||||
|
ArchiveBrowserViewModel * model,
|
||||||
|
{
|
||||||
size_t size_menu = menu_array_size(model->context_menu);
|
size_t size_menu = menu_array_size(model->context_menu);
|
||||||
if(event->key == InputKeyUp) {
|
if(event->key == InputKeyUp) {
|
||||||
model->menu_idx = ((model->menu_idx - 1) + size_menu) % size_menu;
|
model->menu_idx = ((model->menu_idx - 1) + size_menu) % size_menu;
|
||||||
} else if(event->key == InputKeyDown) {
|
} else if(event->key == InputKeyDown) {
|
||||||
model->menu_idx = (model->menu_idx + 1) % size_menu;
|
model->menu_idx = (model->menu_idx + 1) % size_menu;
|
||||||
}
|
}
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
} else if(event->key == InputKeyOk) {
|
} else if(event->key == InputKeyOk) {
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
browser->view, (ArchiveBrowserViewModel * model) {
|
browser->view,
|
||||||
|
ArchiveBrowserViewModel * model,
|
||||||
|
{
|
||||||
ArchiveContextMenuItem_t* current =
|
ArchiveContextMenuItem_t* current =
|
||||||
menu_array_get(model->context_menu, model->menu_idx);
|
menu_array_get(model->context_menu, model->menu_idx);
|
||||||
idx = current->event;
|
idx = current->event;
|
||||||
return false;
|
},
|
||||||
});
|
false);
|
||||||
browser->callback(idx, browser->context);
|
browser->callback(idx, browser->context);
|
||||||
} else if(event->key == InputKeyBack) {
|
} else if(event->key == InputKeyBack) {
|
||||||
browser->callback(ArchiveBrowserEventFileMenuClose, browser->context);
|
browser->callback(ArchiveBrowserEventFileMenuClose, browser->context);
|
||||||
|
@ -503,11 +507,13 @@ void browser_free(ArchiveBrowserView* browser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
browser->view, (ArchiveBrowserViewModel * model) {
|
browser->view,
|
||||||
|
ArchiveBrowserViewModel * model,
|
||||||
|
{
|
||||||
files_array_clear(model->files);
|
files_array_clear(model->files);
|
||||||
menu_array_clear(model->context_menu);
|
menu_array_clear(model->context_menu);
|
||||||
return false;
|
},
|
||||||
});
|
false);
|
||||||
|
|
||||||
furi_string_free(browser->path);
|
furi_string_free(browser->path);
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, FuriString* line) {
|
||||||
} else if(strncmp(line_tmp, ducky_cmd_sysrq, strlen(ducky_cmd_sysrq)) == 0) {
|
} else if(strncmp(line_tmp, ducky_cmd_sysrq, strlen(ducky_cmd_sysrq)) == 0) {
|
||||||
// SYSRQ
|
// SYSRQ
|
||||||
line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1];
|
line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1];
|
||||||
uint16_t key = ducky_get_keycode(line_tmp, true);
|
uint16_t key = ducky_get_keycode(bad_usb, line_tmp, true);
|
||||||
furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN);
|
furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN);
|
||||||
furi_hal_hid_kb_press(key);
|
furi_hal_hid_kb_press(key);
|
||||||
furi_hal_hid_kb_release_all();
|
furi_hal_hid_kb_release_all();
|
||||||
|
|
|
@ -188,10 +188,10 @@ void bad_usb_set_file_name(BadUsb* bad_usb, const char* name) {
|
||||||
void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) {
|
void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) {
|
||||||
furi_assert(layout);
|
furi_assert(layout);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
bad_usb->view, (BadUsbModel * model) {
|
bad_usb->view,
|
||||||
strlcpy(model->layout, layout, MAX_NAME_LEN);
|
BadUsbModel * model,
|
||||||
return true;
|
{ strlcpy(model->layout, layout, MAX_NAME_LEN); },
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) {
|
void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) {
|
||||||
furi_assert(st);
|
furi_assert(st);
|
||||||
|
|
|
@ -68,10 +68,7 @@ void subghz_view_receiver_set_mode(
|
||||||
SubGhzViewReceiver* subghz_receiver,
|
SubGhzViewReceiver* subghz_receiver,
|
||||||
SubGhzViewReceiverMode mode) {
|
SubGhzViewReceiverMode mode) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_receiver->view, (SubGhzViewReceiverModel * model) {
|
subghz_receiver->view, SubGhzViewReceiverModel * model, { model->mode = mode; }, true);
|
||||||
model->mode = mode;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_view_receiver_set_lock(SubGhzViewReceiver* subghz_receiver, SubGhzLock lock) {
|
void subghz_view_receiver_set_lock(SubGhzViewReceiver* subghz_receiver, SubGhzLock lock) {
|
||||||
|
@ -172,10 +169,10 @@ void subghz_view_receiver_add_data_progress(
|
||||||
const char* progress_str) {
|
const char* progress_str) {
|
||||||
furi_assert(subghz_receiver);
|
furi_assert(subghz_receiver);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
subghz_receiver->view, (SubGhzViewReceiverModel * model) {
|
subghz_receiver->view,
|
||||||
furi_string_set(model->progress_str, progress_str);
|
SubGhzViewReceiverModel * model,
|
||||||
return true;
|
{ furi_string_set(model->progress_str, progress_str); },
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_view_receiver_draw_frame(Canvas* canvas, uint16_t idx, bool scrollbar) {
|
static void subghz_view_receiver_draw_frame(Canvas* canvas, uint16_t idx, bool scrollbar) {
|
||||||
|
|
|
@ -277,7 +277,9 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
|
||||||
if(event->key == InputKeyOk) {
|
if(event->key == InputKeyOk) {
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubGhzFrequencyAnalyzerModel * model) {
|
instance->view,
|
||||||
|
SubGhzFrequencyAnalyzerModel * model,
|
||||||
|
{
|
||||||
uint32_t prev_freq_to_save = model->frequency_to_save;
|
uint32_t prev_freq_to_save = model->frequency_to_save;
|
||||||
uint32_t frequency_candidate = 0;
|
uint32_t frequency_candidate = 0;
|
||||||
if(model->frequency != 0) {
|
if(model->frequency != 0) {
|
||||||
|
@ -305,8 +307,8 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
|
||||||
notification_message(instance->notifications, &sequence_hw_blink);
|
notification_message(instance->notifications, &sequence_hw_blink);
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
FURI_LOG_I(
|
FURI_LOG_I(
|
||||||
|
@ -340,14 +342,16 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
|
||||||
if(need_redraw) {
|
if(need_redraw) {
|
||||||
SubGhzFrequencyAnalyzer* instance = context;
|
SubGhzFrequencyAnalyzer* instance = context;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubGhzFrequencyAnalyzerModel * model) {
|
instance->view,
|
||||||
|
SubGhzFrequencyAnalyzerModel * model,
|
||||||
|
{
|
||||||
model->rssi_last = instance->rssi_last;
|
model->rssi_last = instance->rssi_last;
|
||||||
model->frequency_last = instance->frequency_last;
|
model->frequency_last = instance->frequency_last;
|
||||||
model->trigger =
|
model->trigger =
|
||||||
subghz_frequency_analyzer_worker_get_trigger_level(instance->worker);
|
subghz_frequency_analyzer_worker_get_trigger_level(instance->worker);
|
||||||
model->feedback_level = instance->feedback_level;
|
model->feedback_level = instance->feedback_level;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -415,8 +419,8 @@ void subghz_frequency_analyzer_pair_callback(void* context, uint32_t frequency,
|
||||||
model->frequency_last = instance->frequency_last_vis;
|
model->frequency_last = instance->frequency_last_vis;
|
||||||
model->trigger = subghz_frequency_analyzer_worker_get_trigger_level(instance->worker);
|
model->trigger = subghz_frequency_analyzer_worker_get_trigger_level(instance->worker);
|
||||||
model->feedback_level = instance->feedback_level;
|
model->feedback_level = instance->feedback_level;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_frequency_analyzer_enter(void* context) {
|
void subghz_frequency_analyzer_enter(void* context) {
|
||||||
|
@ -452,8 +456,8 @@ void subghz_frequency_analyzer_enter(void* context) {
|
||||||
model->frequency_last = 0;
|
model->frequency_last = 0;
|
||||||
model->frequency_to_save = 0;
|
model->frequency_to_save = 0;
|
||||||
model->trigger = RSSI_MIN;
|
model->trigger = RSSI_MIN;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_frequency_analyzer_exit(void* context) {
|
void subghz_frequency_analyzer_exit(void* context) {
|
||||||
|
@ -507,10 +511,10 @@ uint32_t subghz_frequency_analyzer_get_frequency_to_save(SubGhzFrequencyAnalyzer
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubGhzFrequencyAnalyzerModel * model) {
|
instance->view,
|
||||||
frequency = model->frequency_to_save;
|
SubGhzFrequencyAnalyzerModel * model,
|
||||||
return false;
|
{ frequency = model->frequency_to_save; },
|
||||||
});
|
false);
|
||||||
|
|
||||||
return frequency;
|
return frequency;
|
||||||
}
|
}
|
|
@ -378,7 +378,9 @@ bool subghz_read_raw_input(InputEvent* event, void* context) {
|
||||||
true);
|
true);
|
||||||
} else if(event->key == InputKeyLeft && event->type == InputTypeShort) {
|
} else if(event->key == InputKeyLeft && event->type == InputTypeShort) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubGhzReadRAWModel * model) {
|
instance->view,
|
||||||
|
SubGhzReadRAWModel * model,
|
||||||
|
{
|
||||||
if(!model->raw_send_only) {
|
if(!model->raw_send_only) {
|
||||||
if(model->status == SubGhzReadRAWStatusStart) {
|
if(model->status == SubGhzReadRAWStatusStart) {
|
||||||
//Config
|
//Config
|
||||||
|
@ -399,7 +401,9 @@ bool subghz_read_raw_input(InputEvent* event, void* context) {
|
||||||
true);
|
true);
|
||||||
} else if(event->key == InputKeyRight && event->type == InputTypeShort) {
|
} else if(event->key == InputKeyRight && event->type == InputTypeShort) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubGhzReadRAWModel * model) {
|
instance->view,
|
||||||
|
SubGhzReadRAWModel * model,
|
||||||
|
{
|
||||||
if(!model->raw_send_only) {
|
if(!model->raw_send_only) {
|
||||||
if(model->status == SubGhzReadRAWStatusIDLE) {
|
if(model->status == SubGhzReadRAWStatusIDLE) {
|
||||||
//Save
|
//Save
|
||||||
|
|
|
@ -46,21 +46,23 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||||
if(event->key == InputKeyBack && event->type == InputTypeShort) {
|
if(event->key == InputKeyBack && event->type == InputTypeShort) {
|
||||||
instance->callback(SubBruteCustomEventTypeBackPressed, instance->context);
|
instance->callback(SubBruteCustomEventTypeBackPressed, instance->context);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteAttackViewModel * model,
|
||||||
|
{
|
||||||
model->is_attacking = false;
|
model->is_attacking = false;
|
||||||
model->is_continuous_worker = false;
|
model->is_continuous_worker = false;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_attacking = false;
|
bool is_attacking = false;
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
is_attacking = model->is_attacking;
|
SubBruteAttackViewModel * model,
|
||||||
return false;
|
{ is_attacking = model->is_attacking; },
|
||||||
});
|
false);
|
||||||
|
|
||||||
// if(!is_attacking) {
|
// if(!is_attacking) {
|
||||||
// instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
// instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
||||||
|
@ -74,13 +76,15 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||||
FURI_LOG_D(TAG, "InputKey: %d OK", event->key);
|
FURI_LOG_D(TAG, "InputKey: %d OK", event->key);
|
||||||
#endif
|
#endif
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteAttackViewModel * model,
|
||||||
|
{
|
||||||
model->is_attacking = true;
|
model->is_attacking = true;
|
||||||
model->is_continuous_worker = false;
|
model->is_continuous_worker = false;
|
||||||
icon_animation_stop(model->icon);
|
icon_animation_stop(model->icon);
|
||||||
icon_animation_start(model->icon);
|
icon_animation_start(model->icon);
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
instance->callback(SubBruteCustomEventTypeTransmitStarted, instance->context);
|
instance->callback(SubBruteCustomEventTypeTransmitStarted, instance->context);
|
||||||
/*if(event->type == InputTypeRepeat && event->key == InputKeyOk) {
|
/*if(event->type == InputTypeRepeat && event->key == InputKeyOk) {
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
|
@ -151,13 +155,15 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||||
if((event->type == InputTypeShort || event->type == InputTypeRepeat) &&
|
if((event->type == InputTypeShort || event->type == InputTypeRepeat) &&
|
||||||
(event->key == InputKeyOk || event->key == InputKeyBack)) {
|
(event->key == InputKeyOk || event->key == InputKeyBack)) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteAttackViewModel * model,
|
||||||
|
{
|
||||||
model->is_attacking = false;
|
model->is_attacking = false;
|
||||||
model->is_continuous_worker = false;
|
model->is_continuous_worker = false;
|
||||||
icon_animation_stop(model->icon);
|
icon_animation_stop(model->icon);
|
||||||
icon_animation_start(model->icon);
|
icon_animation_start(model->icon);
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,11 +179,13 @@ SubBruteAttackView* subbrute_attack_view_alloc() {
|
||||||
view_set_context(instance->view, instance);
|
view_set_context(instance->view, instance);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteAttackViewModel * model,
|
||||||
|
{
|
||||||
model->icon = icon_animation_alloc(&A_Sub1ghz_14);
|
model->icon = icon_animation_alloc(&A_Sub1ghz_14);
|
||||||
view_tie_icon_animation(instance->view, model->icon);
|
view_tie_icon_animation(instance->view, model->icon);
|
||||||
return false;
|
},
|
||||||
});
|
false);
|
||||||
|
|
||||||
view_set_draw_callback(instance->view, (ViewDrawCallback)subbrute_attack_view_draw);
|
view_set_draw_callback(instance->view, (ViewDrawCallback)subbrute_attack_view_draw);
|
||||||
view_set_input_callback(instance->view, subbrute_attack_view_input);
|
view_set_input_callback(instance->view, subbrute_attack_view_input);
|
||||||
|
@ -203,10 +211,10 @@ void subbrute_attack_view_free(SubBruteAttackView* instance) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
icon_animation_free(model->icon);
|
SubBruteAttackViewModel * model,
|
||||||
return false;
|
{ icon_animation_free(model->icon); },
|
||||||
});
|
false);
|
||||||
|
|
||||||
view_free(instance->view);
|
view_free(instance->view);
|
||||||
free(instance);
|
free(instance);
|
||||||
|
@ -223,19 +231,19 @@ void subbrute_attack_view_set_current_step(SubBruteAttackView* instance, uint64_
|
||||||
//FURI_LOG_D(TAG, "Set step: %d", current_step);
|
//FURI_LOG_D(TAG, "Set step: %d", current_step);
|
||||||
#endif
|
#endif
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
model->current_step = current_step;
|
SubBruteAttackViewModel * model,
|
||||||
return true;
|
{ model->current_step = current_step; },
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subbrute_attack_view_set_worker_type(SubBruteAttackView* instance, bool is_continuous_worker) {
|
void subbrute_attack_view_set_worker_type(SubBruteAttackView* instance, bool is_continuous_worker) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
model->is_continuous_worker = is_continuous_worker;
|
SubBruteAttackViewModel * model,
|
||||||
return true;
|
{ model->is_continuous_worker = is_continuous_worker; },
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to call init every time, because not every time we calls enter
|
// We need to call init every time, because not every time we calls enter
|
||||||
|
@ -255,7 +263,9 @@ void subbrute_attack_view_init_values(
|
||||||
current_step);
|
current_step);
|
||||||
#endif
|
#endif
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteAttackViewModel * model,
|
||||||
|
{
|
||||||
model->max_value = max_value;
|
model->max_value = max_value;
|
||||||
model->index = index;
|
model->index = index;
|
||||||
model->current_step = current_step;
|
model->current_step = current_step;
|
||||||
|
@ -265,8 +275,8 @@ void subbrute_attack_view_init_values(
|
||||||
} else {
|
} else {
|
||||||
icon_animation_stop(model->icon);
|
icon_animation_stop(model->icon);
|
||||||
}
|
}
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subbrute_attack_view_exit(void* context) {
|
void subbrute_attack_view_exit(void* context) {
|
||||||
|
@ -276,10 +286,10 @@ void subbrute_attack_view_exit(void* context) {
|
||||||
FURI_LOG_D(TAG, "subbrute_attack_view_exit");
|
FURI_LOG_D(TAG, "subbrute_attack_view_exit");
|
||||||
#endif
|
#endif
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteAttackViewModel * model) {
|
instance->view,
|
||||||
icon_animation_stop(model->icon);
|
SubBruteAttackViewModel * model,
|
||||||
return false;
|
{ icon_animation_stop(model->icon); },
|
||||||
});
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void elements_button_top_left(Canvas* canvas, const char* str) {
|
void elements_button_top_left(Canvas* canvas, const char* str) {
|
||||||
|
|
|
@ -173,17 +173,19 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||||
uint8_t index = 0;
|
uint8_t index = 0;
|
||||||
bool is_select_byte = false;
|
bool is_select_byte = false;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view,
|
||||||
is_select_byte = model->is_select_byte;
|
SubBruteMainViewModel * model,
|
||||||
return false;
|
{ is_select_byte = model->is_select_byte; },
|
||||||
});
|
false);
|
||||||
|
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
if(!is_select_byte) {
|
if(!is_select_byte) {
|
||||||
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
||||||
|
bool ret = false;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view,
|
||||||
bool ret = false;
|
SubBruteMainViewModel * model,
|
||||||
|
{
|
||||||
uint8_t items_on_screen = 3;
|
uint8_t items_on_screen = 3;
|
||||||
if(event->key == InputKeyUp) {
|
if(event->key == InputKeyUp) {
|
||||||
if(model->index == min_value) {
|
if(model->index == min_value) {
|
||||||
|
@ -219,8 +221,8 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index = model->index;
|
index = model->index;
|
||||||
return ret;
|
},
|
||||||
});
|
ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
|
@ -243,7 +245,9 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||||
} else {
|
} else {
|
||||||
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteMainViewModel * model,
|
||||||
|
{
|
||||||
if(event->key == InputKeyLeft) {
|
if(event->key == InputKeyLeft) {
|
||||||
if(model->index > 0) {
|
if(model->index > 0) {
|
||||||
model->index--;
|
model->index--;
|
||||||
|
@ -255,8 +259,8 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
index = model->index;
|
index = model->index;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
|
@ -304,13 +308,15 @@ SubBruteMainView* subbrute_main_view_alloc() {
|
||||||
view_set_exit_callback(instance->view, subbrute_main_view_exit);
|
view_set_exit_callback(instance->view, subbrute_main_view_exit);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteMainViewModel * model,
|
||||||
|
{
|
||||||
model->index = 0;
|
model->index = 0;
|
||||||
model->window_position = 0;
|
model->window_position = 0;
|
||||||
model->key_field = NULL;
|
model->key_field = NULL;
|
||||||
model->is_select_byte = false;
|
model->is_select_byte = false;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +344,9 @@ void subbrute_main_view_set_index(
|
||||||
FURI_LOG_I(TAG, "Set index: %d", idx);
|
FURI_LOG_I(TAG, "Set index: %d", idx);
|
||||||
#endif
|
#endif
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view,
|
||||||
|
SubBruteMainViewModel * model,
|
||||||
|
{
|
||||||
model->is_select_byte = is_select_byte;
|
model->is_select_byte = is_select_byte;
|
||||||
model->key_field = key_field;
|
model->key_field = key_field;
|
||||||
model->index = idx;
|
model->index = idx;
|
||||||
|
@ -359,8 +367,8 @@ void subbrute_main_view_set_index(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SubBruteAttacks subbrute_main_view_get_index(SubBruteMainView* instance) {
|
SubBruteAttacks subbrute_main_view_get_index(SubBruteMainView* instance) {
|
||||||
|
@ -368,10 +376,7 @@ SubBruteAttacks subbrute_main_view_get_index(SubBruteMainView* instance) {
|
||||||
|
|
||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view, (SubBruteMainViewModel * model) {
|
instance->view, SubBruteMainViewModel * model, { idx = model->index; }, false);
|
||||||
idx = model->index;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
FURI_LOG_D(TAG, "Get index: %d", idx);
|
FURI_LOG_D(TAG, "Get index: %d", idx);
|
||||||
|
|
|
@ -146,52 +146,39 @@ View* wav_player_view_get_view(WavPlayerView* wav_view) {
|
||||||
void wav_player_view_set_volume(WavPlayerView* wav_view, float volume) {
|
void wav_player_view_set_volume(WavPlayerView* wav_view, float volume) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view, WavPlayerViewModel * model, { model->volume = volume; }, true);
|
||||||
model->volume = volume;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_start(WavPlayerView* wav_view, size_t start) {
|
void wav_player_view_set_start(WavPlayerView* wav_view, size_t start) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view, WavPlayerViewModel * model, { model->start = start; }, true);
|
||||||
model->start = start;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_end(WavPlayerView* wav_view, size_t end) {
|
void wav_player_view_set_end(WavPlayerView* wav_view, size_t end) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view, WavPlayerViewModel * model, { model->end = end; }, true);
|
||||||
model->end = end;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_current(WavPlayerView* wav_view, size_t current) {
|
void wav_player_view_set_current(WavPlayerView* wav_view, size_t current) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view, WavPlayerViewModel * model, { model->current = current; }, true);
|
||||||
model->current = current;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_play(WavPlayerView* wav_view, bool play) {
|
void wav_player_view_set_play(WavPlayerView* wav_view, bool play) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view, WavPlayerViewModel * model, { model->play = play; }, true);
|
||||||
model->play = play;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count) {
|
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count) {
|
||||||
furi_assert(wav_view);
|
furi_assert(wav_view);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
wav_view->view, (WavPlayerViewModel * model) {
|
wav_view->view,
|
||||||
|
WavPlayerViewModel * model,
|
||||||
|
{
|
||||||
size_t inc = (data_count / DATA_COUNT) - 1;
|
size_t inc = (data_count / DATA_COUNT) - 1;
|
||||||
|
|
||||||
for(size_t i = 0; i < DATA_COUNT; i++) {
|
for(size_t i = 0; i < DATA_COUNT; i++) {
|
||||||
|
@ -199,8 +186,8 @@ void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t da
|
||||||
if(model->data[i] > 42) model->data[i] = 42;
|
if(model->data[i] > 42) model->data[i] = 42;
|
||||||
data += inc;
|
data += inc;
|
||||||
}
|
}
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_player_view_set_ctrl_callback(WavPlayerView* wav_view, WavPlayerCtrlCallback callback) {
|
void wav_player_view_set_ctrl_callback(WavPlayerView* wav_view, WavPlayerCtrlCallback callback) {
|
||||||
|
|
|
@ -87,11 +87,13 @@ ButtonPanel* button_panel_alloc() {
|
||||||
|
|
||||||
void button_panel_reset_selection(ButtonPanel* button_panel) {
|
void button_panel_reset_selection(ButtonPanel* button_panel) {
|
||||||
with_view_model(
|
with_view_model(
|
||||||
button_panel->view, (ButtonPanelModel * model) {
|
button_panel->view,
|
||||||
|
ButtonPanelModel * model,
|
||||||
|
{
|
||||||
model->selected_item_x = 0;
|
model->selected_item_x = 0;
|
||||||
model->selected_item_y = 0;
|
model->selected_item_y = 0;
|
||||||
return true;
|
},
|
||||||
});
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y) {
|
void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y) {
|
||||||
|
|
Loading…
Reference in a new issue