Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
use badusb folder instead of badkb
Browse files Browse the repository at this point in the history
move user files at the app start
  • Loading branch information
xMasterX committed Mar 20, 2024
1 parent b6be0d6 commit 8bb11fd
Show file tree
Hide file tree
Showing 39 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool file_browser_scene_start_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;

if(event.type == SceneManagerEventTypeCustom) {
furi_string_set(app->file_path, ANY_PATH("badkb/demo_windows.txt"));
furi_string_set(app->file_path, ANY_PATH("badusb/demo_windows.txt"));
scene_manager_next_scene(app->scene_manager, FileBrowserSceneBrowser);
consumed = true;
} else if(event.type == SceneManagerEventTypeTick) {
Expand Down
2 changes: 1 addition & 1 deletion applications/external
2 changes: 1 addition & 1 deletion applications/main/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static const char* tab_default_paths[] = {
[ArchiveTabSubGhz] = EXT_PATH("subghz"),
[ArchiveTabLFRFID] = EXT_PATH("lfrfid"),
[ArchiveTabInfrared] = EXT_PATH("infrared"),
[ArchiveTabBadKb] = EXT_PATH("badkb"),
[ArchiveTabBadKb] = EXT_PATH("badusb"),
[ArchiveTabU2f] = "/app:u2f",
[ArchiveTabApplications] = EXT_PATH("apps"),
[ArchiveTabSearch] = "/app:search",
Expand Down
2 changes: 1 addition & 1 deletion applications/main/bad_kb/bad_kb_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void bad_kb_app_tick_event_callback(void* context) {
scene_manager_handle_tick_event(app->scene_manager);
}

static void bad_kb_load_settings(BadKbApp* app) {
void bad_kb_load_settings(BadKbApp* app) {
furi_string_reset(app->keyboard_layout);
BadKbConfig* cfg = &app->config;

Expand Down
2 changes: 2 additions & 0 deletions applications/main/bad_kb/bad_kb_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ void bad_kb_conn_reset(BadKbApp* app);
void bad_kb_config_refresh(BadKbApp* app);

void bad_kb_config_adjust(BadKbConfig* cfg);

void bad_kb_load_settings(BadKbApp* app);
2 changes: 1 addition & 1 deletion applications/main/bad_kb/bad_kb_paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <storage/storage.h>

#define BAD_KB_APP_BASE_FOLDER EXT_PATH("badkb")
#define BAD_KB_APP_BASE_FOLDER EXT_PATH("badusb")
#define BAD_KB_KEYS_PATH BAD_KB_APP_BASE_FOLDER "/.badkb.keys"
#define BAD_KB_SETTINGS_PATH BAD_KB_APP_BASE_FOLDER "/.badkb.settings"
#define BAD_KB_APP_PATH_LAYOUT_FOLDER BAD_KB_APP_BASE_FOLDER "/assets/layouts"
19 changes: 12 additions & 7 deletions applications/main/bad_kb/scenes/bad_kb_scene_file_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ static bool bad_kb_file_select(BadKbApp* bad_kb) {

bad_kb_app_show_loading_popup(bad_kb, true);
Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_dir_exists(storage, EXT_PATH("badusb"))) {
if(storage_dir_exists(storage, EXT_PATH("badkb"))) {
DialogMessage* message = dialog_message_alloc();
dialog_message_set_header(message, "Migrate BadUSB?", 64, 0, AlignCenter, AlignTop);
dialog_message_set_buttons(message, "No", NULL, "Yes");
dialog_message_set_header(message, "Migrate Scripts", 64, 0, AlignCenter, AlignTop);
dialog_message_set_buttons(message, NULL, NULL, "Ok");
dialog_message_set_text(
message,
"A badusb folder was found!\n"
"XFW uses the badkb folder.\n"
"Want to transfer the files?",
"Scripts will be moved to\n"
"'badusb' folder\n"
"for compatibility.",
64,
32,
AlignCenter,
Expand All @@ -25,7 +25,12 @@ static bool bad_kb_file_select(BadKbApp* bad_kb) {
dialog_message_free(message);
furi_record_close(RECORD_DIALOGS);
if(res == DialogMessageButtonRight) {
storage_common_migrate(storage, EXT_PATH("badusb"), BAD_KB_APP_BASE_FOLDER);
storage_common_migrate(storage, EXT_PATH("badkb"), BAD_KB_APP_BASE_FOLDER);
if(bad_kb->conn_init_thread) {
furi_thread_join(bad_kb->conn_init_thread);
}
bad_kb_load_settings(bad_kb);
bad_kb_config_adjust(&bad_kb->config);
}
}
storage_simply_mkdir(storage, BAD_KB_APP_BASE_FOLDER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool xtreme_app_scene_protocols_freqs_hopper_on_event(void* context, SceneManage
variable_item_list_get(app->var_item_list, VarItemListIndexHopperFrequency);
variable_item_set_values_count(item, FrequencyList_size(app->subghz_hopper_freqs));
if(FrequencyList_size(app->subghz_hopper_freqs)) {
app->subghz_hopper_index -= removed;
app->subghz_hopper_index -= MIN(removed, app->subghz_hopper_index);
uint32_t value =
*FrequencyList_get(app->subghz_hopper_freqs, app->subghz_hopper_index);
char text[10] = {0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool xtreme_app_scene_protocols_freqs_static_on_event(void* context, SceneManage
variable_item_list_get(app->var_item_list, VarItemListIndexStaticFrequency);
variable_item_set_values_count(item, FrequencyList_size(app->subghz_static_freqs));
if(FrequencyList_size(app->subghz_static_freqs)) {
app->subghz_static_index -= removed;
app->subghz_static_index -= MIN(removed, app->subghz_static_index);
uint32_t value =
*FrequencyList_get(app->subghz_static_freqs, app->subghz_static_index);
char text[10] = {0};
Expand Down

0 comments on commit 8bb11fd

Please sign in to comment.