diff --git a/applications/external/ir_remote/infrared_remote_app.c b/applications/external/ir_remote/infrared_remote_app.c index 409bfddd3..5ced9e71f 100644 --- a/applications/external/ir_remote/infrared_remote_app.c +++ b/applications/external/ir_remote/infrared_remote_app.c @@ -110,8 +110,7 @@ static void app_input_callback(InputEvent* input_event, void* ctx) { furi_message_queue_put(event_queue, input_event, FuriWaitForever); } -int32_t infrared_remote_app(void* p) { - UNUSED(p); +int32_t infrared_remote_app(char* p) { FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(InputEvent)); dolphin_deed(DolphinDeedPluginStart); @@ -141,22 +140,26 @@ int32_t infrared_remote_app(void* p) { InputEvent event; + FuriString* map_file = furi_string_alloc(); Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* ff = flipper_format_file_alloc(storage); - - DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options(&browser_options, ".txt", &I_sub1_10px); - browser_options.base_path = IR_REMOTE_PATH; - FuriString* map_file = furi_string_alloc(); - furi_string_set(map_file, IR_REMOTE_PATH); if(!storage_file_exists(storage, IR_REMOTE_PATH)) { storage_common_mkdir(storage, IR_REMOTE_PATH); //Make Folder If dir not exist } - bool res = dialog_file_browser_show(dialogs, map_file, map_file, &browser_options); - - furi_record_close(RECORD_DIALOGS); + bool res; + if(p && strlen(p)) { + furi_string_set(map_file, p); + res = true; + } else { + DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options(&browser_options, ".txt", &I_sub1_10px); + browser_options.base_path = IR_REMOTE_PATH; + furi_string_set(map_file, IR_REMOTE_PATH); + res = dialog_file_browser_show(dialogs, map_file, map_file, &browser_options); + furi_record_close(RECORD_DIALOGS); + } // if user didn't choose anything, free everything and exit if(!res) { diff --git a/applications/external/subghz_playlist/playlist.c b/applications/external/subghz_playlist/playlist.c index c300a0020..12191dc96 100644 --- a/applications/external/subghz_playlist/playlist.c +++ b/applications/external/subghz_playlist/playlist.c @@ -693,7 +693,7 @@ void playlist_free(Playlist* app) { free(app); } -int32_t playlist_app(void* p) { +int32_t playlist_app(char* p) { UNUSED(p); dolphin_deed(DolphinDeedPluginStart); @@ -723,7 +723,9 @@ int32_t playlist_app(void* p) { furi_hal_power_suppress_charge_enter(); // select playlist file - { + if(p && strlen(p)) { + furi_string_set(app->file_path, p); + } else { DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); DialogsFileBrowserOptions browser_options; dialog_file_browser_set_basic_options(&browser_options, PLAYLIST_EXT, &I_sub1_10px); diff --git a/applications/external/subghz_remote/subghz_remote_app.c b/applications/external/subghz_remote/subghz_remote_app.c index 4f88f6358..c0682c75e 100644 --- a/applications/external/subghz_remote/subghz_remote_app.c +++ b/applications/external/subghz_remote/subghz_remote_app.c @@ -19,7 +19,7 @@ static void subghz_remote_app_tick_event_callback(void* context) { scene_manager_handle_tick_event(app->scene_manager); } -SubGhzRemoteApp* subghz_remote_app_alloc() { +SubGhzRemoteApp* subghz_remote_app_alloc(char* p) { SubGhzRemoteApp* app = malloc(sizeof(SubGhzRemoteApp)); Storage* storage = furi_record_open(RECORD_STORAGE); @@ -91,13 +91,19 @@ SubGhzRemoteApp* subghz_remote_app_alloc() { subghz_txrx_set_need_save_callback(app->txrx, subrem_save_active_sub, app); + if(p && strlen(p)) { + furi_string_set(app->file_path, p); + subrem_map_file_load(app, furi_string_get_cstr(app->file_path)); + scene_manager_next_scene(app->scene_manager, SubRemSceneRemote); + } else { #ifdef SUBREM_LIGHT - scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); #else - scene_manager_next_scene(app->scene_manager, SubRemSceneStart); - scene_manager_set_scene_state( - app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemOpenMapFile); + scene_manager_next_scene(app->scene_manager, SubRemSceneStart); + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemOpenMapFile); #endif + } return app; } @@ -146,12 +152,10 @@ void subghz_remote_app_free(SubGhzRemoteApp* app) { free(app); } -int32_t subghz_remote_app(void* p) { +int32_t subghz_remote_app(char* p) { UNUSED(p); dolphin_deed(DolphinDeedPluginStart); - SubGhzRemoteApp* subghz_remote_app = subghz_remote_app_alloc(); - - furi_string_set(subghz_remote_app->file_path, SUBREM_APP_FOLDER); + SubGhzRemoteApp* subghz_remote_app = subghz_remote_app_alloc(p); view_dispatcher_run(subghz_remote_app->view_dispatcher); diff --git a/applications/external/subghz_remote/subghz_remote_app_i.h b/applications/external/subghz_remote/subghz_remote_app_i.h index a2ecc0c73..0d25134ad 100644 --- a/applications/external/subghz_remote/subghz_remote_app_i.h +++ b/applications/external/subghz_remote/subghz_remote_app_i.h @@ -52,3 +52,5 @@ bool subrem_tx_start_sub(SubGhzRemoteApp* app, SubRemSubFilePreset* sub_preset); bool subrem_tx_stop_sub(SubGhzRemoteApp* app, bool forced); void subrem_save_active_sub(void* context); + +SubRemLoadMapState subrem_map_file_load(SubGhzRemoteApp* app, const char* file_path);