mfc_editor_app_i.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include <furi.h>
  3. #include <dialogs/dialogs.h>
  4. #include <gui/gui.h>
  5. #include <gui/scene_manager.h>
  6. #include <gui/view_dispatcher.h>
  7. #include <gui/modules/popup.h>
  8. #include <gui/modules/submenu.h>
  9. #include <nfc/nfc.h>
  10. #include <nfc/nfc_device.h>
  11. #include <nfc/protocols/mf_classic/mf_classic.h>
  12. #include <storage/storage.h>
  13. #include "mfc_editor_app.h"
  14. #include "mfc_editor_icons.h"
  15. #include "scenes/mfc_editor_scene.h"
  16. #define TAG "MFCEditor"
  17. #define NFC_APP_FOLDER ANY_PATH("nfc")
  18. #define NFC_APP_EXTENSION ".nfc"
  19. #define NFC_APP_SHADOW_EXTENSION ".shd"
  20. enum MfcEditorCustomEvent {
  21. // Reserve first 100 events for button types and indexes, starting from 0
  22. MfcEditorCustomEventReserved = 100,
  23. MfcEditorCustomEventViewExit,
  24. };
  25. struct MfcEditorApp {
  26. ViewDispatcher* view_dispatcher;
  27. SceneManager* scene_manager;
  28. Gui* gui;
  29. Storage* storage;
  30. DialogsApp* dialogs;
  31. Submenu* submenu;
  32. Popup* popup;
  33. NfcDevice* nfc_device;
  34. const MfClassicData* mf_classic_data;
  35. FuriString* file_path;
  36. uint8_t current_sector;
  37. uint8_t current_block;
  38. };
  39. typedef enum {
  40. MfcEditorAppViewSubmenu,
  41. MfcEditorAppViewPopup,
  42. } MfcEditorAppView;
  43. typedef enum {
  44. // Generic
  45. MfcEditorPromptResponseSuccess,
  46. MfcEditorPromptResponseFailure,
  47. MfcEditorPromptResponseNotMfClassic,
  48. // Backed out of a prompt
  49. MfcEditorPromptResponseExitedFile,
  50. MfcEditorPromptResponseExitedShadow,
  51. } MfcEditorPromptResponse;
  52. MfcEditorPromptResponse mfc_editor_prompt_load_file(MfcEditorApp* instance);
  53. MfcEditorPromptResponse mfc_editor_load_file(MfcEditorApp* instance, FuriString* file_path);