2022-01-05 19:10:18 +03:00
|
|
|
#include "lfrfid_app_scene_save_data.h"
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 12:20:41 +03:00
|
|
|
#include <dolphin/dolphin.h>
|
2021-06-30 15:02:46 +03:00
|
|
|
|
|
|
|
static void print_buffer(const uint8_t* buffer) {
|
|
|
|
for(uint8_t i = 0; i < LFRFID_KEY_SIZE; i++) {
|
|
|
|
printf("%02X", buffer[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LfRfidAppSceneSaveData::on_enter(LfRfidApp* app, bool need_restore) {
|
|
|
|
auto byte_input = app->view_controller.get<ByteInputVM>();
|
|
|
|
RfidKey& key = app->worker.key;
|
|
|
|
|
|
|
|
printf("k: ");
|
|
|
|
print_buffer(key.get_data());
|
|
|
|
printf(" o: ");
|
|
|
|
print_buffer(old_key_data);
|
|
|
|
printf(" n: ");
|
|
|
|
print_buffer(new_key_data);
|
|
|
|
printf("\r\n");
|
|
|
|
if(need_restore) printf("restored\r\n");
|
|
|
|
|
|
|
|
if(need_restore) {
|
|
|
|
key.set_data(old_key_data, key.get_type_data_count());
|
|
|
|
} else {
|
|
|
|
memcpy(old_key_data, key.get_data(), key.get_type_data_count());
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_key_data, key.get_data(), key.get_type_data_count());
|
|
|
|
byte_input->set_header_text("Enter the data in hex");
|
|
|
|
|
|
|
|
byte_input->set_result_callback(
|
|
|
|
save_callback, NULL, app, new_key_data, app->worker.key.get_type_data_count());
|
|
|
|
|
|
|
|
app->view_controller.switch_to<ByteInputVM>();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LfRfidAppSceneSaveData::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
|
|
|
|
bool consumed = false;
|
|
|
|
RfidKey& key = app->worker.key;
|
|
|
|
|
|
|
|
if(event->type == LfRfidApp::EventType::Next) {
|
|
|
|
key.set_data(new_key_data, key.get_type_data_count());
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 12:20:41 +03:00
|
|
|
DOLPHIN_DEED(DolphinDeedRfidAdd);
|
2021-06-30 15:02:46 +03:00
|
|
|
app->scene_controller.switch_to_next_scene(LfRfidApp::SceneType::SaveName);
|
|
|
|
}
|
|
|
|
|
|
|
|
return consumed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LfRfidAppSceneSaveData::on_exit(LfRfidApp* app) {
|
|
|
|
app->view_controller.get<ByteInputVM>()->clean();
|
|
|
|
}
|
|
|
|
|
2021-07-04 19:01:16 +03:00
|
|
|
void LfRfidAppSceneSaveData::save_callback(void* context) {
|
2021-06-30 15:02:46 +03:00
|
|
|
LfRfidApp* app = static_cast<LfRfidApp*>(context);
|
|
|
|
LfRfidApp::Event event;
|
|
|
|
event.type = LfRfidApp::EventType::Next;
|
|
|
|
app->view_controller.send_event(&event);
|
|
|
|
}
|