mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 15:04:19 +00:00
[FL-2229] New assets paths (#978)
* assets: change resources paths * apps: rework nfc, irda and subghz with new assets path * subghz: remove unused paths * subghz: fix incorrect path * badusb and u2f fix Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: nminaylov <nm29719@gmail.com>
This commit is contained in:
parent
d2c4f15af5
commit
838df4c9ea
23 changed files with 28 additions and 40 deletions
|
@ -8,7 +8,7 @@ static const char* tab_default_paths[] = {
|
|||
[ArchiveTabFavorites] = "/any/favorites",
|
||||
[ArchiveTabIButton] = "/any/ibutton",
|
||||
[ArchiveTabNFC] = "/any/nfc",
|
||||
[ArchiveTabSubGhz] = "/any/subghz/saved",
|
||||
[ArchiveTabSubGhz] = "/any/subghz",
|
||||
[ArchiveTabLFRFID] = "/any/lfrfid",
|
||||
[ArchiveTabIrda] = "/any/irda",
|
||||
[ArchiveTabBrowser] = "/any",
|
||||
|
|
|
@ -19,7 +19,7 @@ void bad_usb_scene_file_select_on_enter(void* context) {
|
|||
BadUsbApp* bad_usb = context;
|
||||
|
||||
if(bad_usb_file_select(bad_usb)) {
|
||||
scene_manager_next_scene(bad_usb->scene_manager, BadUsbAppViewWork);
|
||||
scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork);
|
||||
} else {
|
||||
//scene_manager_previous_scene(bad_usb->scene_manager);
|
||||
view_dispatcher_stop(bad_usb->view_dispatcher);
|
||||
|
|
|
@ -159,7 +159,7 @@ class IrdaAppSceneUniversalTV : public IrdaAppSceneUniversalCommon {
|
|||
public:
|
||||
void on_enter(IrdaApp* app) final;
|
||||
IrdaAppSceneUniversalTV()
|
||||
: IrdaAppSceneUniversalCommon("/ext/irda/universal/tv.ir") {
|
||||
: IrdaAppSceneUniversalCommon("/ext/irda/assets/tv.ir") {
|
||||
}
|
||||
~IrdaAppSceneUniversalTV() {
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class IrdaAppSceneUniversalAudio : public IrdaAppSceneUniversalCommon {
|
|||
public:
|
||||
void on_enter(IrdaApp* app) final;
|
||||
IrdaAppSceneUniversalAudio()
|
||||
: IrdaAppSceneUniversalCommon("/ext/irda/universal/audio.ir") {
|
||||
: IrdaAppSceneUniversalCommon("/ext/irda/assets/audio.ir") {
|
||||
}
|
||||
~IrdaAppSceneUniversalAudio() {
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ bool nfc_emv_parser_get_aid_name(
|
|||
for(uint8_t i = 0; i < aid_len; i++) {
|
||||
string_cat_printf(key, "%02X", aid[i]);
|
||||
}
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/aid.nfc", key, aid_name)) {
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/aid.nfc", key, aid_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
@ -58,7 +58,7 @@ bool nfc_emv_parser_get_country_name(
|
|||
bool parsed = false;
|
||||
string_t key;
|
||||
string_init_printf(key, "%04X", country_code);
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/country_code.nfc", key, country_name)) {
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/country_code.nfc", key, country_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
@ -72,7 +72,8 @@ bool nfc_emv_parser_get_currency_name(
|
|||
bool parsed = false;
|
||||
string_t key;
|
||||
string_init_printf(key, "%04X", currency_code);
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/emv/currency_code.nfc", key, currency_name)) {
|
||||
if(nfc_emv_parser_search_data(
|
||||
storage, "/ext/nfc/assets/currency_code.nfc", key, currency_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
|
|
@ -23,7 +23,7 @@ bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
|
|||
path_extract_filename_no_ext(string_get_cstr(temp_str), temp_str);
|
||||
strcpy(subghz->file_name, string_get_cstr(temp_str));
|
||||
string_printf(
|
||||
temp_str, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
temp_str, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
subghz_protocol_raw_set_last_file_name(
|
||||
(SubGhzProtocolRAW*)subghz->txrx->protocol_result, string_get_cstr(temp_str));
|
||||
|
|
|
@ -39,7 +39,7 @@ void subghz_scene_save_name_on_enter(void* context) {
|
|||
dev_name_empty);
|
||||
|
||||
ValidatorIsFile* validator_is_file =
|
||||
validator_is_file_alloc_init(SUBGHZ_APP_PATH_FOLDER, SUBGHZ_APP_EXTENSION);
|
||||
validator_is_file_alloc_init(SUBGHZ_APP_FOLDER, SUBGHZ_APP_EXTENSION);
|
||||
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
|
||||
|
||||
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewTextInput);
|
||||
|
|
|
@ -284,10 +284,10 @@ int32_t subghz_app(void* p) {
|
|||
|
||||
//Load database
|
||||
bool load_database =
|
||||
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes");
|
||||
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes_user");
|
||||
subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_flor_s_rx");
|
||||
subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/came_atomo");
|
||||
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/assets/keeloq_mfcodes");
|
||||
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/assets/keeloq_mfcodes_user");
|
||||
subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/assets/nice_flor_s_rx");
|
||||
subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/assets/came_atomo");
|
||||
|
||||
// Check argument and run corresponding scene
|
||||
if(p && subghz_key_load(subghz, p)) {
|
||||
|
|
|
@ -215,10 +215,10 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
|
|||
furi_check(instance->stream);
|
||||
|
||||
SubGhzParser* parser = subghz_parser_alloc();
|
||||
subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes");
|
||||
subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes_user");
|
||||
subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/nice_flor_s_rx");
|
||||
subghz_parser_load_came_atomo_file(parser, "/ext/subghz/came_atomo");
|
||||
subghz_parser_load_keeloq_file(parser, "/ext/subghz/assets/keeloq_mfcodes");
|
||||
subghz_parser_load_keeloq_file(parser, "/ext/subghz/assets/keeloq_mfcodes_user");
|
||||
subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/assets/nice_flor_s_rx");
|
||||
subghz_parser_load_came_atomo_file(parser, "/ext/subghz/assets/came_atomo");
|
||||
subghz_parser_enable_dump_text(parser, subghz_cli_command_rx_text_callback, instance);
|
||||
|
||||
// Configure radio
|
||||
|
|
20
applications/subghz/subghz_i.c
Normal file → Executable file
20
applications/subghz/subghz_i.c
Normal file → Executable file
|
@ -284,7 +284,7 @@ bool subghz_get_next_name_file(SubGhz* subghz) {
|
|||
if(strcmp(subghz->file_name, "")) {
|
||||
//get the name of the next free file
|
||||
storage_get_next_filename(
|
||||
storage, SUBGHZ_RAW_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION, temp_str);
|
||||
storage, SUBGHZ_RAW_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION, temp_str);
|
||||
|
||||
strcpy(subghz->file_name, string_get_cstr(temp_str));
|
||||
res = true;
|
||||
|
@ -319,15 +319,9 @@ bool subghz_save_protocol_to_file(SubGhz* subghz, const char* dev_name) {
|
|||
dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder");
|
||||
break;
|
||||
}
|
||||
// Create saved directory if necessary
|
||||
if(!storage_simply_mkdir(storage, SUBGHZ_APP_PATH_FOLDER)) {
|
||||
dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder");
|
||||
break;
|
||||
}
|
||||
|
||||
// First remove subghz device file if it was saved
|
||||
string_printf(
|
||||
dev_file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
|
||||
string_printf(dev_file_name, "%s/%s%s", SUBGHZ_APP_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
if(!storage_simply_remove(storage, string_get_cstr(dev_file_name))) {
|
||||
break;
|
||||
|
@ -386,7 +380,7 @@ bool subghz_load_protocol_from_file(SubGhz* subghz) {
|
|||
// Input events and views are managed by file_select
|
||||
bool res = dialog_file_select_show(
|
||||
subghz->dialogs,
|
||||
SUBGHZ_APP_PATH_FOLDER,
|
||||
SUBGHZ_APP_FOLDER,
|
||||
SUBGHZ_APP_EXTENSION,
|
||||
subghz->file_name,
|
||||
sizeof(subghz->file_name),
|
||||
|
@ -394,7 +388,7 @@ bool subghz_load_protocol_from_file(SubGhz* subghz) {
|
|||
|
||||
if(res) {
|
||||
string_printf(
|
||||
file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
file_name, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
res = subghz_key_load(subghz, string_get_cstr(file_name));
|
||||
}
|
||||
|
@ -413,10 +407,10 @@ bool subghz_rename_file(SubGhz* subghz) {
|
|||
Storage* storage = furi_record_open("storage");
|
||||
|
||||
string_init_printf(
|
||||
old_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
old_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
string_init_printf(
|
||||
new_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
new_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
FS_Error fs_result =
|
||||
storage_common_rename(storage, string_get_cstr(old_path), string_get_cstr(new_path));
|
||||
|
@ -439,7 +433,7 @@ bool subghz_delete_file(SubGhz* subghz) {
|
|||
Storage* storage = furi_record_open("storage");
|
||||
string_t file_path;
|
||||
string_init_printf(
|
||||
file_path, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
file_path, "%s/%s%s", SUBGHZ_APP_FOLDER, subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
bool result = storage_simply_remove(storage, string_get_cstr(file_path));
|
||||
furi_record_close("storage");
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#define TAG "U2F"
|
||||
|
||||
#define U2F_DATA_FOLDER "/any/u2f/"
|
||||
#define U2F_CERT_FILE U2F_DATA_FOLDER "cert.der"
|
||||
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "cert_key.u2f"
|
||||
#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
|
||||
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
|
||||
#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f"
|
||||
#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f"
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#define DURATION_DIFF(x, y) ((x < y) ? (y - x) : (x - y))
|
||||
|
||||
#define SUBGHZ_APP_FOLDER "/any/subghz"
|
||||
#define SUBGHZ_APP_PATH_FOLDER "/any/subghz/saved"
|
||||
#define SUBGHZ_RAW_FOLDER "/ext/subghz"
|
||||
#define SUBGHZ_RAW_PATH_FOLDER "/ext/subghz/saved"
|
||||
#define SUBGHZ_APP_EXTENSION ".sub"
|
||||
#define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 2048
|
||||
|
||||
|
|
7
lib/subghz/protocols/subghz_protocol_raw.c
Normal file → Executable file
7
lib/subghz/protocols/subghz_protocol_raw.c
Normal file → Executable file
|
@ -176,15 +176,10 @@ bool subghz_protocol_raw_save_to_file_init(
|
|||
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_FOLDER)) {
|
||||
break;
|
||||
}
|
||||
// Create saved directory if necessary
|
||||
if(!storage_simply_mkdir(instance->storage, SUBGHZ_RAW_PATH_FOLDER)) {
|
||||
break;
|
||||
}
|
||||
|
||||
string_set(instance->file_name, dev_name);
|
||||
// First remove subghz device file if it was saved
|
||||
string_printf(
|
||||
dev_file_name, "%s/%s%s", SUBGHZ_APP_PATH_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
|
||||
string_printf(dev_file_name, "%s/%s%s", SUBGHZ_RAW_FOLDER, dev_name, SUBGHZ_APP_EXTENSION);
|
||||
|
||||
if(!storage_simply_remove(instance->storage, string_get_cstr(dev_file_name))) {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue