From 3f7d07b1655ef5277e650156846e1bd8357a2b3c Mon Sep 17 00:00:00 2001 From: TollyH Date: Sat, 27 Jan 2024 18:19:50 +0000 Subject: [PATCH] Fix 4K access bit edit header --- .../scenes/mfc_editor_scene_data_edit_access_bits.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mfc-editor/scenes/mfc_editor_scene_data_edit_access_bits.c b/mfc-editor/scenes/mfc_editor_scene_data_edit_access_bits.c index 59c0729..a05305f 100644 --- a/mfc-editor/scenes/mfc_editor_scene_data_edit_access_bits.c +++ b/mfc-editor/scenes/mfc_editor_scene_data_edit_access_bits.c @@ -47,11 +47,15 @@ void mfc_editor_scene_data_edit_access_bits_on_enter(void* context) { if(instance->current_sector >= 32 && !mf_classic_is_sector_trailer(instance->current_block)) { // 4K large sector - access bits affect range of blocks + uint8_t sector_start_num = + mf_classic_get_first_block_num_of_sector(instance->current_sector); + // Relative to the sector start, round down to multiple of 5 + uint8_t relative_block_num = (instance->current_block - sector_start_num) / 5 * 5; furi_string_printf( instance->data_view_header, "Edit B. %u-%u Access", - instance->current_block / 5 * 5, - instance->current_block / 5 * 5 + 4); + sector_start_num + relative_block_num, + sector_start_num + relative_block_num + 4); } else { furi_string_printf( instance->data_view_header, "Edit Block %u Access", instance->current_block);