From 3efc8ff3c00e3b791437f959488a2da4fe458d3e Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Fri, 11 Nov 2022 17:05:30 -0500 Subject: [PATCH] fmt --- applications/plugins/badger2040/badger2040.c | 55 +- applications/plugins/chess/fast_chess.c | 6 +- .../plugins/namechanger/namechanger.c | 95 ++- .../scenes/namechanger_scene_change.c | 3 +- .../scenes/namechanger_scene_change_success.c | 18 +- .../scenes/namechanger_scene_revert.c | 5 +- .../scenes/namechanger_scene_revert_success.c | 7 +- .../wii_ec_anal/_image_tool/_convert.c | 234 +++--- .../wii_ec_anal/_image_tool/_convert_images.c | 206 +++-- .../wii_ec_anal/_image_tool/_convert_images.h | 66 +- .../wii_ec_anal/_image_tool/_convert_test.c | 82 +- applications/plugins/wii_ec_anal/bc_logging.h | 54 +- applications/plugins/wii_ec_anal/err.h | 91 ++- applications/plugins/wii_ec_anal/gfx/images.c | 206 +++-- applications/plugins/wii_ec_anal/gfx/images.h | 228 +++--- .../plugins/wii_ec_anal/gfx/img_3x5_0.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_2.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_3.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_4.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_5.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_6.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_7.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_8.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_9.c | 4 +- .../plugins/wii_ec_anal/gfx/img_3x5_v.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_0.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_2.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_3.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_4.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_5.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_6.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_7.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_8.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_9.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_A.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_B.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_C.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_D.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_E.c | 4 +- .../plugins/wii_ec_anal/gfx/img_5x7_F.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_0.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_2.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_3.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_4.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_5.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_6.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_7.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_8.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_9.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_A.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_B.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_C.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_D.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_E.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_F.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_G.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_X.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_Y.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_Z.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_d_.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_n_.c | 4 +- .../plugins/wii_ec_anal/gfx/img_6x8_v_.c | 4 +- .../plugins/wii_ec_anal/gfx/img_RIP.c | 118 +-- .../plugins/wii_ec_anal/gfx/img_cc_Cable.c | 14 +- .../plugins/wii_ec_anal/gfx/img_cc_Joy.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_Main.c | 80 +- .../plugins/wii_ec_anal/gfx/img_cc_btn_A1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_btn_B1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_btn_X1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_btn_Y1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_pad_LR1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_pad_UD1.c | 4 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_L1.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_L2.c | 22 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_L3.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_L4.c | 18 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_R1.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_R2.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_R3.c | 10 +- .../plugins/wii_ec_anal/gfx/img_cc_trg_R4.c | 21 +- .../plugins/wii_ec_anal/gfx/img_csLogo_FULL.c | 84 +- .../wii_ec_anal/gfx/img_csLogo_Small.c | 10 +- .../plugins/wii_ec_anal/gfx/img_ecp_SCL.c | 10 +- .../plugins/wii_ec_anal/gfx/img_ecp_SDA.c | 8 +- .../plugins/wii_ec_anal/gfx/img_ecp_port.c | 48 +- .../plugins/wii_ec_anal/gfx/img_key_Back.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_D.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_L.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_OK.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_OKi.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_R.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_U.c | 5 +- .../plugins/wii_ec_anal/gfx/img_key_Ui.c | 5 +- .../plugins/wii_ec_anal/i2c_workaround.h | 128 +-- applications/plugins/wii_ec_anal/wii_anal.c | 765 +++++++++--------- applications/plugins/wii_ec_anal/wii_anal.h | 118 ++- .../plugins/wii_ec_anal/wii_anal_ec.c | 166 ++-- .../plugins/wii_ec_anal/wii_anal_ec.h | 12 +- .../plugins/wii_ec_anal/wii_anal_keys.c | 412 +++++----- .../plugins/wii_ec_anal/wii_anal_keys.h | 18 +- .../plugins/wii_ec_anal/wii_anal_lcd.c | 323 +++++--- .../plugins/wii_ec_anal/wii_anal_lcd.h | 58 +- .../plugins/wii_ec_anal/wii_anal_ver.h | 10 +- applications/plugins/wii_ec_anal/wii_ec.c | 376 +++++---- applications/plugins/wii_ec_anal/wii_ec.h | 206 +++-- .../plugins/wii_ec_anal/wii_ec_classic.c | 575 +++++++------ .../plugins/wii_ec_anal/wii_ec_classic.h | 69 +- .../plugins/wii_ec_anal/wii_ec_macros.h | 150 ++-- .../plugins/wii_ec_anal/wii_ec_nunchuck.c | 715 ++++++++-------- .../plugins/wii_ec_anal/wii_ec_nunchuck.h | 53 +- .../plugins/wii_ec_anal/wii_ec_udraw.c | 160 ++-- .../plugins/wii_ec_anal/wii_ec_udraw.h | 20 +- applications/plugins/wii_ec_anal/wii_i2c.c | 364 ++++----- applications/plugins/wii_ec_anal/wii_i2c.h | 24 +- 117 files changed, 3537 insertions(+), 3298 deletions(-) diff --git a/applications/plugins/badger2040/badger2040.c b/applications/plugins/badger2040/badger2040.c index 5cbed37ed..ff115d22b 100644 --- a/applications/plugins/badger2040/badger2040.c +++ b/applications/plugins/badger2040/badger2040.c @@ -20,10 +20,7 @@ typedef enum { EventTypeKey, } EventType; -typedef enum { - BadgerGetAddress, - BadgerSend -} STATE; +typedef enum { BadgerGetAddress, BadgerSend } STATE; typedef struct { EventType type; @@ -56,22 +53,22 @@ static void render_callback(Canvas* const canvas, void* ctx) { char str[32]; - if (plugin_state->state == BadgerGetAddress) { + if(plugin_state->state == BadgerGetAddress) { sprintf(str, "Selected Address: %d", plugin_state->address); canvas_draw_str(canvas, ADDRESS_QUESTION_X, ADDRESS_QUESTION_Y, str); - if (plugin_state->get_failed) { + if(plugin_state->get_failed) { strcpy(str, "Error! Device not found!"); canvas_draw_str(canvas, ERROR_X, ERROR_Y, str); } - } else if (plugin_state->state == BadgerSend) { + } else if(plugin_state->state == BadgerSend) { sprintf(str, "Sending to Address: %d", plugin_state->address); canvas_draw_str(canvas, ADDRESS_QUESTION_X, ADDRESS_QUESTION_Y, str); sprintf(str, "Data: %d", plugin_state->data); canvas_draw_str(canvas, DATA_X, DATA_Y, str); - if (plugin_state->send_failed) { + if(plugin_state->send_failed) { strcpy(str, "Error! Unable to send data!"); canvas_draw_str(canvas, ERROR_X, ERROR_Y, str); } @@ -88,22 +85,21 @@ static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queu } bool device_exists(int address) { - if (DEBUG) return true; + if(DEBUG) return true; uint32_t response_timeout_ticks = furi_ms_to_ticks(5.f); return furi_hal_i2c_is_device_ready( - &furi_hal_i2c_handle_external, - address << 1, - response_timeout_ticks); + &furi_hal_i2c_handle_external, address << 1, response_timeout_ticks); } bool sendData(uint8_t address, uint8_t data) { - if (DEBUG) return true; + if(DEBUG) return true; uint32_t response_timeout_ticks = furi_ms_to_ticks(5.f); - return furi_hal_i2c_tx(&furi_hal_i2c_handle_external, address, &data, 1, response_timeout_ticks); + return furi_hal_i2c_tx( + &furi_hal_i2c_handle_external, address, &data, 1, response_timeout_ticks); } int32_t badger2040_app(void* p) { @@ -141,28 +137,27 @@ int32_t badger2040_app(void* p) { // press events if(event.type == EventTypeKey) { if((event.input.type == InputTypePress) || (event.input.type == InputTypeRepeat)) { - // Reset failed status to clear display after key press - if (plugin_state->state == BadgerGetAddress) { + if(plugin_state->state == BadgerGetAddress) { plugin_state->get_failed = false; - } else if (plugin_state->state == BadgerSend) { + } else if(plugin_state->state == BadgerSend) { plugin_state->send_failed = false; } switch(event.input.key) { case InputKeyUp: - if (plugin_state->state == BadgerGetAddress) { + if(plugin_state->state == BadgerGetAddress) { uint8_t prevAddr = plugin_state->address; - if (prevAddr == HIGHEST_I2C_ADDRESS) { + if(prevAddr == HIGHEST_I2C_ADDRESS) { plugin_state->address = FIRST_NON_RESERVED_I2C_ADDRESS; } else { plugin_state->address = prevAddr + 1; } - } else if (plugin_state->state == BadgerSend) { + } else if(plugin_state->state == BadgerSend) { uint8_t prevData = plugin_state->data; - if (prevData == MAX_DATA) { + if(prevData == MAX_DATA) { plugin_state->data = MIN_DATA; } else { plugin_state->data = prevData + 1; @@ -170,18 +165,18 @@ int32_t badger2040_app(void* p) { } break; case InputKeyDown: - if (plugin_state->state == BadgerGetAddress) { + if(plugin_state->state == BadgerGetAddress) { uint8_t prevAddr = plugin_state->address; - if (prevAddr == FIRST_NON_RESERVED_I2C_ADDRESS) { + if(prevAddr == FIRST_NON_RESERVED_I2C_ADDRESS) { plugin_state->address = HIGHEST_I2C_ADDRESS; } else { plugin_state->address = prevAddr - 1; } - } else if (plugin_state->state == BadgerSend) { + } else if(plugin_state->state == BadgerSend) { uint8_t prevData = plugin_state->data; - if (prevData == MIN_DATA) { + if(prevData == MIN_DATA) { plugin_state->data = MAX_DATA; } else { plugin_state->data = prevData - 1; @@ -193,16 +188,16 @@ int32_t badger2040_app(void* p) { case InputKeyLeft: break; case InputKeyOk: - if (plugin_state->state == BadgerGetAddress) { - if (device_exists(plugin_state->address)) { - if (plugin_state->state == BadgerGetAddress) { + if(plugin_state->state == BadgerGetAddress) { + if(device_exists(plugin_state->address)) { + if(plugin_state->state == BadgerGetAddress) { plugin_state->state = BadgerSend; } } else { plugin_state->get_failed = true; } - } else if (plugin_state->state == BadgerSend) { - if (!sendData) { + } else if(plugin_state->state == BadgerSend) { + if(!sendData) { plugin_state->send_failed = true; } } diff --git a/applications/plugins/chess/fast_chess.c b/applications/plugins/chess/fast_chess.c index 427a403ab..d9d42e42c 100644 --- a/applications/plugins/chess/fast_chess.c +++ b/applications/plugins/chess/fast_chess.c @@ -2357,7 +2357,7 @@ Node iterativeDeepeningAlphaBeta(Position* position, char depth, int alpha, int int score = iterativeDeepeningAlphaBeta(&newPosition, depth - 1, alpha, beta, FALSE).score; if(verbose) { - printf("%.2f\n", (double) score / (double) 100.00); + printf("%.2f\n", (double)score / (double)100.00); fflush(stdout); } @@ -2850,8 +2850,8 @@ Move getAIMove(Game* game, int depth) { printf( " in %d seconds [%+.2f, %+.2f]\n", (int)(endTime - startTime), - (double) staticEvaluation(&game->position) / (double) 100.0, - (double) node.score / (double) 100.0); + (double)staticEvaluation(&game->position) / (double)100.0, + (double)node.score / (double)100.0); fflush(stdout); return node.move; diff --git a/applications/plugins/namechanger/namechanger.c b/applications/plugins/namechanger/namechanger.c index 649f139a3..284fd2eb5 100644 --- a/applications/plugins/namechanger/namechanger.c +++ b/applications/plugins/namechanger/namechanger.c @@ -18,107 +18,107 @@ bool namechanger_back_event_callback(void* context) { bool namechanger_make_app_folder(NameChanger* namechanger) { bool created = false; - FURI_LOG_I(TAG, "folder1"); + FURI_LOG_I(TAG, "folder1"); FuriString* folderpath = furi_string_alloc(); furi_string_set(folderpath, "/ext/dolphin"); - FURI_LOG_I(TAG, "folder2"); + FURI_LOG_I(TAG, "folder2"); //Make dir if doesn't exist if(!storage_simply_mkdir(namechanger->storage, furi_string_get_cstr(folderpath))) { - FURI_LOG_I(TAG, "folder3"); + FURI_LOG_I(TAG, "folder3"); furi_string_set_str(namechanger->error, "Cannot create\napp folder."); } else { - FURI_LOG_I(TAG, "folder4"); + FURI_LOG_I(TAG, "folder4"); created = true; } - FURI_LOG_I(TAG, "folder5"); + FURI_LOG_I(TAG, "folder5"); furi_string_free(folderpath); - FURI_LOG_I(TAG, "folder6"); + FURI_LOG_I(TAG, "folder6"); return created; } bool namechanger_name_read_write(NameChanger* namechanger, char* name, uint8_t mode) { FuriString* file_path = furi_string_alloc(); furi_string_set(file_path, "/ext/dolphin/name.txt"); - FURI_LOG_I(TAG, "name1"); + FURI_LOG_I(TAG, "name1"); bool result = false; if(mode == 2) { - FURI_LOG_I(TAG, "name2"); + FURI_LOG_I(TAG, "name2"); UNUSED(name); FlipperFormat* file = flipper_format_file_alloc(namechanger->storage); //read FuriString* data = furi_string_alloc(); - FURI_LOG_I(TAG, "name3"); + FURI_LOG_I(TAG, "name3"); do { - FURI_LOG_I(TAG, "name4"); + FURI_LOG_I(TAG, "name4"); if(!flipper_format_file_open_existing(file, furi_string_get_cstr(file_path))) { break; } - FURI_LOG_I(TAG, "name4a"); + FURI_LOG_I(TAG, "name4a"); // header uint32_t version; - + if(!flipper_format_read_header(file, data, &version)) { break; } - FURI_LOG_I(TAG, "name4b"); + FURI_LOG_I(TAG, "name4b"); if(furi_string_cmp_str(data, NAMECHANGER_HEADER) != 0) { break; } - FURI_LOG_I(TAG, "name4c"); + FURI_LOG_I(TAG, "name4c"); if(version != 1) { break; } - FURI_LOG_I(TAG, "name4d"); + FURI_LOG_I(TAG, "name4d"); // get Name if(!flipper_format_read_string(file, "Name", data)) { break; } - FURI_LOG_I(TAG, "name4e"); + FURI_LOG_I(TAG, "name4e"); result = true; - FURI_LOG_I(TAG, "name5"); + FURI_LOG_I(TAG, "name5"); } while(false); flipper_format_free(file); - FURI_LOG_I(TAG, "name6"); + FURI_LOG_I(TAG, "name6"); if(!result) { - FURI_LOG_I(TAG, "name7"); + FURI_LOG_I(TAG, "name7"); FURI_LOG_E(TAG, "Cannot load data from file."); namechanger_text_store_set(namechanger, "%s", furi_hal_version_get_name_ptr()); } else { - FURI_LOG_I(TAG, "name8"); + FURI_LOG_I(TAG, "name8"); furi_string_trim(data); if(!furi_string_size(data)) { - FURI_LOG_I(TAG, "name9"); + FURI_LOG_I(TAG, "name9"); namechanger_text_store_set(namechanger, "%s", furi_hal_version_get_name_ptr()); } else { - FURI_LOG_I(TAG, "name10"); + FURI_LOG_I(TAG, "name10"); char newname[8]; snprintf(newname, 8, "%s", furi_string_get_cstr(data)); namechanger_text_store_set(namechanger, "%s", newname); } } - FURI_LOG_I(TAG, "name11"); + FURI_LOG_I(TAG, "name11"); furi_string_free(data); } else if(mode == 3) { - FURI_LOG_I(TAG, "name12"); + FURI_LOG_I(TAG, "name12"); //save FlipperFormat* file = flipper_format_file_alloc(namechanger->storage); do { - FURI_LOG_I(TAG, "name13"); + FURI_LOG_I(TAG, "name13"); // Open file for write if(!flipper_format_file_open_always(file, furi_string_get_cstr(file_path))) { break; @@ -145,41 +145,38 @@ bool namechanger_name_read_write(NameChanger* namechanger, char* name, uint8_t m file, "It cannot contain any other characters.")) { break; } - - //If name is eraseerase (set by Revert) - then don't write any name - //otherwise, write name as set in the variable - if(strcmp(name, "eraseerase") == 0) - { - if(!flipper_format_write_string_cstr(file, "Name", "")) { - break; - } - } - else - { - if(!flipper_format_write_string_cstr(file, "Name", name)) { - break; - } - } - FURI_LOG_I(TAG, "name14"); + //If name is eraseerase (set by Revert) - then don't write any name + //otherwise, write name as set in the variable + if(strcmp(name, "eraseerase") == 0) { + if(!flipper_format_write_string_cstr(file, "Name", "")) { + break; + } + } else { + if(!flipper_format_write_string_cstr(file, "Name", name)) { + break; + } + } + + FURI_LOG_I(TAG, "name14"); result = true; } while(false); flipper_format_free(file); - FURI_LOG_I(TAG, "name15"); + FURI_LOG_I(TAG, "name15"); if(!result) { - FURI_LOG_I(TAG, "name16"); + FURI_LOG_I(TAG, "name16"); FURI_LOG_E(TAG, "Cannot save name file."); furi_string_set_str(namechanger->error, "Cannot save\nname file."); } } else { - FURI_LOG_I(TAG, "name17"); + FURI_LOG_I(TAG, "name17"); FURI_LOG_E(TAG, "Something broke."); furi_string_set_str(namechanger->error, "Something broke."); } - FURI_LOG_I(TAG, "name18"); - + FURI_LOG_I(TAG, "name18"); + return result; } @@ -263,9 +260,9 @@ void namechanger_text_store_clear(NameChanger* namechanger) { int32_t namechanger_app() { NameChanger* namechanger = namechanger_alloc(); - - namechanger->error = furi_string_alloc(); - furi_string_set(namechanger->error, "Default"); + + namechanger->error = furi_string_alloc(); + furi_string_set(namechanger->error, "Default"); view_dispatcher_attach_to_gui( namechanger->view_dispatcher, namechanger->gui, ViewDispatcherTypeFullscreen); diff --git a/applications/plugins/namechanger/scenes/namechanger_scene_change.c b/applications/plugins/namechanger/scenes/namechanger_scene_change.c index 9838db585..08150a1bc 100644 --- a/applications/plugins/namechanger/scenes/namechanger_scene_change.c +++ b/applications/plugins/namechanger/scenes/namechanger_scene_change.c @@ -38,7 +38,8 @@ bool namechanger_scene_change_on_event(void* context, SceneManagerEvent event) { if(event.event == NameChangerCustomEventTextEditResult) { if(namechanger_make_app_folder(namechanger)) { if(namechanger_name_read_write(namechanger, namechanger->text_store, 3)) { - scene_manager_next_scene(namechanger->scene_manager, NameChangerSceneChangeSuccess); + scene_manager_next_scene( + namechanger->scene_manager, NameChangerSceneChangeSuccess); } else { scene_manager_search_and_switch_to_previous_scene( namechanger->scene_manager, NameChangerSceneError); diff --git a/applications/plugins/namechanger/scenes/namechanger_scene_change_success.c b/applications/plugins/namechanger/scenes/namechanger_scene_change_success.c index 63f2939bc..1e0c3c2bb 100644 --- a/applications/plugins/namechanger/scenes/namechanger_scene_change_success.c +++ b/applications/plugins/namechanger/scenes/namechanger_scene_change_success.c @@ -9,14 +9,14 @@ void namechanger_scene_change_success_on_enter(void* context) { NameChanger* namechanger = context; Popup* popup = namechanger->popup; - popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); - popup_set_header(popup, "Saved!", 5, 5, AlignLeft, AlignTop); - popup_set_text(popup, "Rebooting...", 5, 17, AlignLeft, AlignTop); + popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); + popup_set_header(popup, "Saved!", 5, 5, AlignLeft, AlignTop); + popup_set_text(popup, "Rebooting...", 5, 17, AlignLeft, AlignTop); - popup_set_callback(popup, namechanger_scene_change_success_popup_callback); - popup_set_context(popup, namechanger); - popup_set_timeout(popup, 5000); - popup_enable_timeout(popup); + popup_set_callback(popup, namechanger_scene_change_success_popup_callback); + popup_set_context(popup, namechanger); + popup_set_timeout(popup, 5000); + popup_enable_timeout(popup); view_dispatcher_switch_to_view(namechanger->view_dispatcher, NameChangerViewPopup); } @@ -46,6 +46,6 @@ void namechanger_scene_change_success_on_exit(void* context) { popup_disable_timeout(popup); popup_set_context(popup, NULL); popup_set_callback(popup, NULL); - - furi_hal_power_reset(); + + furi_hal_power_reset(); } diff --git a/applications/plugins/namechanger/scenes/namechanger_scene_revert.c b/applications/plugins/namechanger/scenes/namechanger_scene_revert.c index d4cfb13e6..b1ab3d75a 100644 --- a/applications/plugins/namechanger/scenes/namechanger_scene_revert.c +++ b/applications/plugins/namechanger/scenes/namechanger_scene_revert.c @@ -16,7 +16,7 @@ void namechanger_scene_revert_on_enter(void* context) { FURI_LOG_I(TAG, "revert3"); widget_add_text_box_element( widget, 0, 0, 128, 25, AlignCenter, AlignCenter, "\e#Revert Name?\e#", false); - widget_add_icon_element(widget, 48, 20, &I_MarioBlock); + widget_add_icon_element(widget, 48, 20, &I_MarioBlock); widget_add_button_element( widget, GuiButtonTypeLeft, "Cancel", namechanger_scene_revert_widget_callback, namechanger); FURI_LOG_I(TAG, "revert4"); @@ -44,7 +44,8 @@ bool namechanger_scene_revert_on_event(void* context, SceneManagerEvent event) { FURI_LOG_I(TAG, "revert9"); if(namechanger_name_read_write(namechanger, "eraseerase", 3)) { FURI_LOG_I(TAG, "revert10"); - scene_manager_next_scene(namechanger->scene_manager, NameChangerSceneRevertSuccess); + scene_manager_next_scene( + namechanger->scene_manager, NameChangerSceneRevertSuccess); } else { FURI_LOG_I(TAG, "revert11"); scene_manager_search_and_switch_to_previous_scene( diff --git a/applications/plugins/namechanger/scenes/namechanger_scene_revert_success.c b/applications/plugins/namechanger/scenes/namechanger_scene_revert_success.c index 14a3e7239..0be0a40ef 100644 --- a/applications/plugins/namechanger/scenes/namechanger_scene_revert_success.c +++ b/applications/plugins/namechanger/scenes/namechanger_scene_revert_success.c @@ -27,7 +27,8 @@ bool namechanger_scene_revert_success_on_event(void* context, SceneManagerEvent if(event.type == SceneManagerEventTypeBack) { consumed = true; - scene_manager_search_and_switch_to_previous_scene(namechanger->scene_manager, NameChangerSceneStart); + scene_manager_search_and_switch_to_previous_scene( + namechanger->scene_manager, NameChangerSceneStart); } else if(event.type == SceneManagerEventTypeCustom) { consumed = true; if(event.event == NameChangerCustomEventBack) { @@ -49,6 +50,6 @@ void namechanger_scene_revert_success_on_exit(void* context) { popup_disable_timeout(popup); popup_set_context(popup, NULL); popup_set_callback(popup, NULL); - - furi_hal_power_reset(); + + furi_hal_power_reset(); } \ No newline at end of file diff --git a/applications/plugins/wii_ec_anal/_image_tool/_convert.c b/applications/plugins/wii_ec_anal/_image_tool/_convert.c index 267985e8d..57deeb083 100644 --- a/applications/plugins/wii_ec_anal/_image_tool/_convert.c +++ b/applications/plugins/wii_ec_anal/_image_tool/_convert.c @@ -3,136 +3,146 @@ #include #include -int main (int argc, char* argv[]) -{ - const unsigned char* pp = NULL; - uint32_t pix = 0; - int bit = 0; +int main(int argc, char* argv[]) { + const unsigned char* pp = NULL; + uint32_t pix = 0; + int bit = 0; - uint8_t b = 0; - uint8_t bcnt = 0; + uint8_t b = 0; + uint8_t bcnt = 0; - unsigned int lcnt = 0; - static const int lmax = 16; // max hex values per line + unsigned int lcnt = 0; + static const int lmax = 16; // max hex values per line - uint8_t* buf = NULL; - uint8_t* bp = NULL; - unsigned int blen = 0; + uint8_t* buf = NULL; + uint8_t* bp = NULL; + unsigned int blen = 0; - uint8_t* cmp = NULL; - uint8_t* cp = NULL; - unsigned int clen = 0; - uint8_t ctag = 0xFF; - uint32_t tag[256] = {0}; - uint32_t tmax = UINT32_MAX; + uint8_t* cmp = NULL; + uint8_t* cp = NULL; + unsigned int clen = 0; + uint8_t ctag = 0xFF; + uint32_t tag[256] = {0}; + uint32_t tmax = UINT32_MAX; - unsigned int x, y, z; + unsigned int x, y, z; - const char* name = argv[1]; - FILE* fh = fopen(argv[2], "wb"); + const char* name = argv[1]; + FILE* fh = fopen(argv[2], "wb"); - uint32_t white = 0xFF; + uint32_t white = 0xFF; - int rv = 0; // assume success + int rv = 0; // assume success - // allocate buffers - blen = ((img.w * img.h) +0x7) >>3; - bp = (buf = calloc(blen +1, 1)); - cp = (cmp = calloc(blen +4, 1)); + // allocate buffers + blen = ((img.w * img.h) + 0x7) >> 3; + bp = (buf = calloc(blen + 1, 1)); + cp = (cmp = calloc(blen + 4, 1)); - // sanity check - if (!fh || !buf || !cmp) { - printf("! fopen() or malloc() fail.\n"); - rv = 255; - goto bail; - } + // sanity check + if(!fh || !buf || !cmp) { + printf("! fopen() or malloc() fail.\n"); + rv = 255; + goto bail; + } - // Find white value - for (x = 1; x < img.bpp; x++) - white = (white << 8) | 0xFF ; + // Find white value + for(x = 1; x < img.bpp; x++) white = (white << 8) | 0xFF; - // build bit pattern - // create the comment as we go - for (pp = img.b, y = 0; y < img.h; y++) { - fprintf(fh, "// "); - for (x = 0; x < img.w; x++) { - // read pixel - for (pix = 0, z = 0; z < img.bpp; pix = (pix << 8) | *pp++, z++) ; - // get bit and draw - if (pix < white) { - b = (b << 1) | 1; - fprintf(fh, "##"); - } else { - b <<= 1; - fprintf(fh, ".."); - } - // got byte - if ((++bcnt) == 8) { - *bp++ = b; - tag[b]++; - bcnt = (b = 0); - } - } - fprintf(fh, "\n"); - } - fprintf(fh, "\n"); - // padding - if (bcnt) { - b <<= (bcnt = 8 - bcnt); - *bp++ = b; - tag[b]++; - } - // Kill the compression - *bp = ~bp[-1]; // https://youtube.com/clip/Ugkx-JZIr16hETy7hz_H6yIdKPtxVe8C5w_V + // build bit pattern + // create the comment as we go + for(pp = img.b, y = 0; y < img.h; y++) { + fprintf(fh, "// "); + for(x = 0; x < img.w; x++) { + // read pixel + for(pix = 0, z = 0; z < img.bpp; pix = (pix << 8) | *pp++, z++) + ; + // get bit and draw + if(pix < white) { + b = (b << 1) | 1; + fprintf(fh, "##"); + } else { + b <<= 1; + fprintf(fh, ".."); + } + // got byte + if((++bcnt) == 8) { + *bp++ = b; + tag[b]++; + bcnt = (b = 0); + } + } + fprintf(fh, "\n"); + } + fprintf(fh, "\n"); + // padding + if(bcnt) { + b <<= (bcnt = 8 - bcnt); + *bp++ = b; + tag[b]++; + } + // Kill the compression + *bp = ~bp[-1]; // https://youtube.com/clip/Ugkx-JZIr16hETy7hz_H6yIdKPtxVe8C5w_V - // Byte run length compression - // Find a good tag - for (x = 0; tmax && (x < 256); x++) { - if (tag[x] < tmax) { - tmax = tag[x]; - ctag = x; - } - } + // Byte run length compression + // Find a good tag + for(x = 0; tmax && (x < 256); x++) { + if(tag[x] < tmax) { + tmax = tag[x]; + ctag = x; + } + } - // compress the data - for (bp = buf, x = 0; (clen < blen) && (x < blen); x++) { - // need at least 4 the same to be worth it - // must compress tag (if it occurs) - if ((bp[x] == bp[x+1]) && (bp[x] == bp[x+2]) && (bp[x] == bp[x+3]) || (bp[x] == ctag)) { - for (y = 1; (y < 255) && (bp[x] == bp[x+y]); y++) ; - *cp++ = ctag; // tag - *cp++ = y; // length - *cp++ = bp[x]; // byte - x += y -1; - clen += 3; - } else { - *cp++ = bp[x]; - clen++; - } - } + // compress the data + for(bp = buf, x = 0; (clen < blen) && (x < blen); x++) { + // need at least 4 the same to be worth it + // must compress tag (if it occurs) + if((bp[x] == bp[x + 1]) && (bp[x] == bp[x + 2]) && (bp[x] == bp[x + 3]) || + (bp[x] == ctag)) { + for(y = 1; (y < 255) && (bp[x] == bp[x + y]); y++) + ; + *cp++ = ctag; // tag + *cp++ = y; // length + *cp++ = bp[x]; // byte + x += y - 1; + clen += 3; + } else { + *cp++ = bp[x]; + clen++; + } + } - // create struct - fprintf(fh, "#include \"images.h\"\n\n"); - fprintf(fh, "const image_t img_%s = { %d, %d, ", name, img.w, img.h); + // create struct + fprintf(fh, "#include \"images.h\"\n\n"); + fprintf(fh, "const image_t img_%s = { %d, %d, ", name, img.w, img.h); - if (clen < blen) { // dump compressed? - fprintf(fh, "true, %d, 0x%02X, { // orig:%d, comp:%.2f%%\n\t", - clen, ctag, blen, 100.0-((clen*100.0)/blen)); - for (x = 0; x < clen; x++) - if (x == clen -1) fprintf(fh, "0x%02X\n}};\n", cmp[x]) ; - else fprintf(fh, "0x%02X%s", cmp[x], (!((x+1)%16)) ? ",\n\t" : ", ") ; + if(clen < blen) { // dump compressed? + fprintf( + fh, + "true, %d, 0x%02X, { // orig:%d, comp:%.2f%%\n\t", + clen, + ctag, + blen, + 100.0 - ((clen * 100.0) / blen)); + for(x = 0; x < clen; x++) + if(x == clen - 1) + fprintf(fh, "0x%02X\n}};\n", cmp[x]); + else + fprintf(fh, "0x%02X%s", cmp[x], (!((x + 1) % 16)) ? ",\n\t" : ", "); - } else { // dump UNcompressed - fprintf(fh, "false, %d, 0, {\n\t", blen); - for (x = 0; x < blen; x++) - if (x == blen -1) fprintf(fh, "0x%02X\n}};\n", buf[x]) ; - else fprintf(fh, "0x%02X%s", buf[x], (!((x+1)%16)) ? ",\n\t" : ", ") ; - } + } else { // dump UNcompressed + fprintf(fh, "false, %d, 0, {\n\t", blen); + for(x = 0; x < blen; x++) + if(x == blen - 1) + fprintf(fh, "0x%02X\n}};\n", buf[x]); + else + fprintf(fh, "0x%02X%s", buf[x], (!((x + 1) % 16)) ? ",\n\t" : ", "); + } bail: - if (fh) fclose(fh) ; - if (buf) free(buf) ; - if (cmp) free(cmp) ; + if(fh) fclose(fh); + if(buf) free(buf); + if(cmp) free(cmp); - return rv; + return rv; } diff --git a/applications/plugins/wii_ec_anal/_image_tool/_convert_images.c b/applications/plugins/wii_ec_anal/_image_tool/_convert_images.c index 57046e9a3..e8ab899f7 100644 --- a/applications/plugins/wii_ec_anal/_image_tool/_convert_images.c +++ b/applications/plugins/wii_ec_anal/_image_tool/_convert_images.c @@ -1,55 +1,49 @@ -#include // GUI (screen/keyboard) API +#include // GUI (screen/keyboard) API -#include "images.h" +#include "images.h" //----------------------------------------------------------------------------- ---------------------------------------- -static Canvas* _canvas; -static uint8_t _tlx; -static uint8_t _tly; +static Canvas* _canvas; +static uint8_t _tlx; +static uint8_t _tly; -static uint8_t _x; -static uint8_t _y; +static uint8_t _x; +static uint8_t _y; -static const image_t* _img; +static const image_t* _img; -static bool _blk; -static Color _set; -static Color _clr; +static bool _blk; +static Color _set; +static Color _clr; //+============================================================================ -static -void _showByteSet (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if (b & m) // plot only SET bits - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteSet(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if(b & m) // plot only SET bits + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ -static -void _showByteClr (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if (!(b & m)) // plot only CLR bits - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteClr(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if(!(b & m)) // plot only CLR bits + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ -static -void _showByteAll (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if ((!!(b & m)) ^ _blk) { // Change colour only when required - canvas_set_color(_canvas, ((b & m) ? _set : _clr)); - _blk = !_blk; - } - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteAll(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if((!!(b & m)) ^ _blk) { // Change colour only when required + canvas_set_color(_canvas, ((b & m) ? _set : _clr)); + _blk = !_blk; + } + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ @@ -61,81 +55,83 @@ void _showByteAll (const uint8_t b) // SHOW_ALL - plot all images pixels as they are // SHOW_ALL_INV - plot all images pixels inverted // -void show (Canvas* const canvas, const uint8_t tlx, const uint8_t tly, - const image_t* img, const showMode_t mode) -{ - void(*fnShow)(const uint8_t) = NULL; +void show( + Canvas* const canvas, + const uint8_t tlx, + const uint8_t tly, + const image_t* img, + const showMode_t mode) { + void (*fnShow)(const uint8_t) = NULL; - const uint8_t* bp = img->data; + const uint8_t* bp = img->data; - // code size optimisation - switch (mode & SHOW_INV_) { - case SHOW_NRM_: - _set = ColorBlack; - _clr = ColorWhite; - break; + // code size optimisation + switch(mode & SHOW_INV_) { + case SHOW_NRM_: + _set = ColorBlack; + _clr = ColorWhite; + break; - case SHOW_INV_: - _set = ColorWhite; - _clr = ColorBlack; - break; + case SHOW_INV_: + _set = ColorWhite; + _clr = ColorBlack; + break; - case SHOW_BLK_: - canvas_set_color(canvas, ColorBlack); - break; + case SHOW_BLK_: + canvas_set_color(canvas, ColorBlack); + break; - case SHOW_WHT_: - canvas_set_color(canvas, ColorWhite); - break; + case SHOW_WHT_: + canvas_set_color(canvas, ColorWhite); + break; + } + switch(mode & SHOW_INV_) { + case SHOW_NRM_: + case SHOW_INV_: + fnShow = _showByteAll; + canvas_set_color(canvas, ColorWhite); + _blk = 0; + break; - } - switch (mode & SHOW_INV_) { - case SHOW_NRM_: - case SHOW_INV_: - fnShow = _showByteAll; - canvas_set_color(canvas, ColorWhite); - _blk = 0; - break; + case SHOW_BLK_: + case SHOW_WHT_: + switch(mode & SHOW_ALL_) { + case SHOW_SET_: + fnShow = _showByteSet; + break; + case SHOW_CLR_: + fnShow = _showByteClr; + break; + } + break; + } + furi_check(fnShow); - case SHOW_BLK_: - case SHOW_WHT_: - switch (mode & SHOW_ALL_) { - case SHOW_SET_: - fnShow = _showByteSet; - break; - case SHOW_CLR_: - fnShow = _showByteClr; - break; - } - break; - } - furi_check(fnShow); + // I want nested functions! + _canvas = canvas; + _img = img; + _tlx = tlx; + _tly = tly; + _x = 0; + _y = 0; - // I want nested functions! - _canvas = canvas; - _img = img; - _tlx = tlx; - _tly = tly; - _x = 0; - _y = 0; + // Compressed + if(img->c) { + for(unsigned int i = 0; i < img->len; i++, bp++) { + // Compressed data? {tag, length, value} + if(*bp == img->tag) { + for(uint16_t c = 0; c < bp[1]; c++) fnShow(bp[2]); + bp += 3 - 1; + i += 3 - 1; - // Compressed - if (img->c) { - for (unsigned int i = 0; i < img->len; i++, bp++) { - // Compressed data? {tag, length, value} - if (*bp == img->tag) { - for (uint16_t c = 0; c < bp[1]; c++) fnShow(bp[2]) ; - bp += 3 -1; - i += 3 -1; + // Uncompressed byte + } else { + fnShow(*bp); + } + } - // Uncompressed byte - } else { - fnShow(*bp); - } - } - - // Not compressed - } else { - for (unsigned int i = 0; i < img->len; i++, bp++) fnShow(*bp) ; - } + // Not compressed + } else { + for(unsigned int i = 0; i < img->len; i++, bp++) fnShow(*bp); + } } diff --git a/applications/plugins/wii_ec_anal/_image_tool/_convert_images.h b/applications/plugins/wii_ec_anal/_image_tool/_convert_images.h index bfc44568e..1743cb409 100644 --- a/applications/plugins/wii_ec_anal/_image_tool/_convert_images.h +++ b/applications/plugins/wii_ec_anal/_image_tool/_convert_images.h @@ -1,53 +1,53 @@ -#ifndef IMAGES_H_ -#define IMAGES_H_ +#ifndef IMAGES_H_ +#define IMAGES_H_ #include #include //----------------------------------------------------------------------------- ---------------------------------------- -typedef - enum showMode { - // {INV:--:WHT:BLK::--:--:CLR:SET} - SHOW_SET_ = 0x01, - SHOW_CLR_ = 0x02, - SHOW_ALL_ = SHOW_SET_ | SHOW_CLR_, +typedef enum showMode { + // {INV:--:WHT:BLK::--:--:CLR:SET} + SHOW_SET_ = 0x01, + SHOW_CLR_ = 0x02, + SHOW_ALL_ = SHOW_SET_ | SHOW_CLR_, - SHOW_BLK_ = 0x10, - SHOW_WHT_ = 0x20, - SHOW_NRM_ = 0x00, - SHOW_INV_ = SHOW_BLK_ | SHOW_WHT_, + SHOW_BLK_ = 0x10, + SHOW_WHT_ = 0x20, + SHOW_NRM_ = 0x00, + SHOW_INV_ = SHOW_BLK_ | SHOW_WHT_, - SHOW_SET_BLK = SHOW_SET_ | SHOW_BLK_, - SHOW_SET_WHT = SHOW_SET_ | SHOW_WHT_, + SHOW_SET_BLK = SHOW_SET_ | SHOW_BLK_, + SHOW_SET_WHT = SHOW_SET_ | SHOW_WHT_, - SHOW_CLR_BLK = SHOW_CLR_ | SHOW_BLK_, - SHOW_CLR_WHT = SHOW_CLR_ | SHOW_WHT_, + SHOW_CLR_BLK = SHOW_CLR_ | SHOW_BLK_, + SHOW_CLR_WHT = SHOW_CLR_ | SHOW_WHT_, - SHOW_ALL = SHOW_ALL_ | SHOW_NRM_, - SHOW_ALL_INV = SHOW_ALL_ | SHOW_INV_, - } -showMode_t; + SHOW_ALL = SHOW_ALL_ | SHOW_NRM_, + SHOW_ALL_INV = SHOW_ALL_ | SHOW_INV_, +} showMode_t; //----------------------------------------------------------------------------- ---------------------------------------- -typedef - struct image { - uint8_t w; // width - uint8_t h; // height - bool c; // compressed? - uint16_t len; // image data length - uint8_t tag; // rle tag - uint8_t data[]; // image data - } -image_t; +typedef struct image { + uint8_t w; // width + uint8_t h; // height + bool c; // compressed? + uint16_t len; // image data length + uint8_t tag; // rle tag + uint8_t data[]; // image data +} image_t; //----------------------------------------------------------------------------- ---------------------------------------- //[TAG] //----------------------------------------------------------------------------- ---------------------------------------- #ifndef IMGTEST -# include - void show (Canvas* const canvas, const uint8_t tlx, const uint8_t tly, - const image_t* img, const showMode_t mode) ; +#include +void show( + Canvas* const canvas, + const uint8_t tlx, + const uint8_t tly, + const image_t* img, + const showMode_t mode); #endif #endif //IMAGES_H_ diff --git a/applications/plugins/wii_ec_anal/_image_tool/_convert_test.c b/applications/plugins/wii_ec_anal/_image_tool/_convert_test.c index 4bdb531d5..fdc2ee946 100644 --- a/applications/plugins/wii_ec_anal/_image_tool/_convert_test.c +++ b/applications/plugins/wii_ec_anal/_image_tool/_convert_test.c @@ -1,59 +1,59 @@ -#include -#include +#include +#include -#include "images.h" +#include "images.h" //----------------------------------------------------------------------------- // This will be the plot function out of your graphics library // -#define PLOT(x,y,c) do { \ - printf("%s", (c ? "#" : ".")); \ - if (x == img->w -1) printf("\n") ; \ -}while(0) +#define PLOT(x, y, c) \ + do { \ + printf("%s", (c ? "#" : ".")); \ + if(x == img->w - 1) printf("\n"); \ + } while(0) //+============================================================================ // The pain we endure to avoid code duplication cleanly // -#define PLOTBYTE(b) do { \ - for (uint8_t m = 0x80; m; m>>=1) { \ - PLOT(x,y, (b & m)); \ - if ( ((++x) == img->w) && !(x = 0) && ((++y) == img->h) ) break ; \ - } \ -}while(0) +#define PLOTBYTE(b) \ + do { \ + for(uint8_t m = 0x80; m; m >>= 1) { \ + PLOT(x, y, (b & m)); \ + if(((++x) == img->w) && !(x = 0) && ((++y) == img->h)) break; \ + } \ + } while(0) -void show (const image_t* img) -{ - // Some variables - const uint8_t* bp = img->data; - unsigned int x = 0; - unsigned int y = 0; +void show(const image_t* img) { + // Some variables + const uint8_t* bp = img->data; + unsigned int x = 0; + unsigned int y = 0; - // Compressed - if (img->c) { - for (unsigned int i = 0; i < img->len; i++, bp++) { - // Compressed data? {tag, length, value} - if (*bp == img->tag) { - for (uint16_t c = 0; c < bp[1]; c++) PLOTBYTE(bp[2]) ; - bp += 3 -1; - i += 3 -1; + // Compressed + if(img->c) { + for(unsigned int i = 0; i < img->len; i++, bp++) { + // Compressed data? {tag, length, value} + if(*bp == img->tag) { + for(uint16_t c = 0; c < bp[1]; c++) PLOTBYTE(bp[2]); + bp += 3 - 1; + i += 3 - 1; - // Uncompressed byte - } else { - PLOTBYTE(*bp); - } - } + // Uncompressed byte + } else { + PLOTBYTE(*bp); + } + } - // Not compressed - } else { - for (unsigned int i = 0; i < img->len; i++, bp++) PLOTBYTE(*bp) ; - } + // Not compressed + } else { + for(unsigned int i = 0; i < img->len; i++, bp++) PLOTBYTE(*bp); + } } -#undef PLOTBYTE +#undef PLOTBYTE //+============================================================================ -int main (void) -{ - show(&img_zzz); - return 0; +int main(void) { + show(&img_zzz); + return 0; } diff --git a/applications/plugins/wii_ec_anal/bc_logging.h b/applications/plugins/wii_ec_anal/bc_logging.h index d9bb48c92..73dda80bd 100644 --- a/applications/plugins/wii_ec_anal/bc_logging.h +++ b/applications/plugins/wii_ec_anal/bc_logging.h @@ -1,13 +1,13 @@ -#ifndef BC_LOGGING_H_ -#define BC_LOGGING_H_ +#ifndef BC_LOGGING_H_ +#define BC_LOGGING_H_ #include -#include "err.h" // appName +#include "err.h" // appName //! WARNING: There is a bug in Furi such that if you crank LOG_LEVEL up to 6=TRACE //! AND you have menu->settings->system->logLevel = trace //! THEN this program will cause the FZ to crash when the plugin exits! -#define LOG_LEVEL 4 +#define LOG_LEVEL 4 //----------------------------------------------------------------------------- ---------------------------------------- // The FlipperZero Settings->System menu allows you to set the logging level at RUN-time @@ -27,44 +27,44 @@ // The FlipperZero Settings->System menu allows you to set the logging level at RUN-time // This lets you limit it at COMPILE-time #ifndef LOG_LEVEL -# define LOG_LEVEL 6 // default = full logging +#define LOG_LEVEL 6 // default = full logging #endif -#if (LOG_LEVEL < 2) -# undef FURI_LOG_E -# define FURI_LOG_E(tag, fmt, ...) +#if(LOG_LEVEL < 2) +#undef FURI_LOG_E +#define FURI_LOG_E(tag, fmt, ...) #endif -#if (LOG_LEVEL < 3) -# undef FURI_LOG_W -# define FURI_LOG_W(tag, fmt, ...) +#if(LOG_LEVEL < 3) +#undef FURI_LOG_W +#define FURI_LOG_W(tag, fmt, ...) #endif -#if (LOG_LEVEL < 4) -# undef FURI_LOG_I -# define FURI_LOG_I(tag, fmt, ...) +#if(LOG_LEVEL < 4) +#undef FURI_LOG_I +#define FURI_LOG_I(tag, fmt, ...) #endif -#if (LOG_LEVEL < 5) -# undef FURI_LOG_D -# define FURI_LOG_D(tag, fmt, ...) +#if(LOG_LEVEL < 5) +#undef FURI_LOG_D +#define FURI_LOG_D(tag, fmt, ...) #endif -#if (LOG_LEVEL < 6) -# undef FURI_LOG_T -# define FURI_LOG_T(tag, fmt, ...) +#if(LOG_LEVEL < 6) +#undef FURI_LOG_T +#define FURI_LOG_T(tag, fmt, ...) #endif //---------------------------------------------------------- // Logging helper macros // -#define ERROR(fmt, ...) FURI_LOG_E(appName, fmt __VA_OPT__(,) __VA_ARGS__) -#define WARN(fmt, ...) FURI_LOG_W(appName, fmt __VA_OPT__(,) __VA_ARGS__) -#define INFO(fmt, ...) FURI_LOG_I(appName, fmt __VA_OPT__(,) __VA_ARGS__) -#define DEBUG(fmt, ...) FURI_LOG_D(appName, fmt __VA_OPT__(,) __VA_ARGS__) -#define TRACE(fmt, ...) FURI_LOG_T(appName, fmt __VA_OPT__(,) __VA_ARGS__) +#define ERROR(fmt, ...) FURI_LOG_E(appName, fmt __VA_OPT__(, ) __VA_ARGS__) +#define WARN(fmt, ...) FURI_LOG_W(appName, fmt __VA_OPT__(, ) __VA_ARGS__) +#define INFO(fmt, ...) FURI_LOG_I(appName, fmt __VA_OPT__(, ) __VA_ARGS__) +#define DEBUG(fmt, ...) FURI_LOG_D(appName, fmt __VA_OPT__(, ) __VA_ARGS__) +#define TRACE(fmt, ...) FURI_LOG_T(appName, fmt __VA_OPT__(, ) __VA_ARGS__) -#define ENTER TRACE("(+) %s", __func__) -#define LEAVE TRACE("(-) %s", __func__) +#define ENTER TRACE("(+) %s", __func__) +#define LEAVE TRACE("(-) %s", __func__) #endif //BC_LOGGING_H_ diff --git a/applications/plugins/wii_ec_anal/err.h b/applications/plugins/wii_ec_anal/err.h index 9398a3fb8..5a25c93f8 100644 --- a/applications/plugins/wii_ec_anal/err.h +++ b/applications/plugins/wii_ec_anal/err.h @@ -1,11 +1,11 @@ // Avoid circular/nested/mulitple inclusion -#ifndef ERR_H_ -#define ERR_H_ +#ifndef ERR_H_ +#define ERR_H_ //----------------------------------------------------------------------------- ---------------------------------------- // Application name // -static const char* const appName = "Wii_i2c"; //$ Name used in log files +static const char* const appName = "Wii_i2c"; //$ Name used in log files //----------------------------------------------------------------------------- ---------------------------------------- // Error codes and messages @@ -13,57 +13,60 @@ static const char* const appName = "Wii_i2c"; //$ Name used in log files // You should only ever (need to) edit this list // ...Watch out for extraneous whitespace after the terminating backslashes -#define FOREACH_ES(esPrial) \ - /* The first line MUST define 'ERR_OK = 0' */ \ - esPrial( 0, ERR_OK , "OK (no error)") \ -\ - esPrial( 1, ERR_MALLOC_QUEUE , "malloc() fail - queue") \ - esPrial( 2, ERR_MALLOC_STATE , "malloc() fail - state") \ - esPrial( 3, ERR_MALLOC_TEXT , "malloc() fail - text") \ - esPrial( 4, ERR_MALLOC_VIEW , "malloc() fail - viewport") \ - esPrial( 5, ERR_NO_MUTEX , "Cannot create mutex") \ - esPrial( 6, ERR_NO_GUI , "Cannot open GUI") \ - esPrial( 7, ERR_NO_TIMER , "Cannot create timer") \ - esPrial( 8, ERR_NO_NOTIFY , "Cannot acquire notifications handle") \ -\ - esPrial(10, ERR_MUTEX_BLOCK , "Mutex block failed") \ - esPrial(11, ERR_MUTEX_RELEASE , "Mutex release failed") \ -\ - esPrial(20, ERR_QUEUE_RTOS , "queue - Undefined RTOS error") \ - esPrial(21, DEBUG_QUEUE_TIMEOUT, "queue - Timeout") \ - esPrial(22, ERR_QUEUE_RESOURCE , "queue - Resource not available") \ - esPrial(23, ERR_QUEUE_BADPRM , "queue - Bad parameter") \ - esPrial(24, ERR_QUEUE_NOMEM , "queue - Out of memory") \ - esPrial(25, ERR_QUEUE_ISR , "queue - Banned in ISR") \ - esPrial(26, ERR_QUEUE_UNK , "queue - Unknown") \ -\ - esPrial(30, WARN_SCAN_START , "Scan - Already started") \ - esPrial(31, WARN_SCAN_STOP , "Scan - Already stopped") \ - esPrial(32, ERR_TIMER_START , "Scan - Cannot start timer") \ - esPrial(33, ERR_TIMER_STOP , "Scan - Cannot stop timer") \ -//[EOT] +#define FOREACH_ES(esPrial) \ + /* The first line MUST define 'ERR_OK = 0' */ \ + esPrial(0, ERR_OK, "OK (no error)") \ + \ + esPrial(1, ERR_MALLOC_QUEUE, "malloc() fail - queue") esPrial( \ + 2, \ + ERR_MALLOC_STATE, \ + "malloc() fail - state") esPrial(3, ERR_MALLOC_TEXT, "malloc() fail - text") \ + esPrial(4, ERR_MALLOC_VIEW, "malloc() fail - viewport") esPrial( \ + 5, ERR_NO_MUTEX, "Cannot create mutex") esPrial(6, ERR_NO_GUI, "Cannot open GUI") \ + esPrial(7, ERR_NO_TIMER, "Cannot create timer") esPrial( \ + 8, ERR_NO_NOTIFY, "Cannot acquire notifications handle") \ + \ + esPrial(10, ERR_MUTEX_BLOCK, "Mutex block failed") esPrial( \ + 11, ERR_MUTEX_RELEASE, "Mutex release failed") \ + \ + esPrial(20, ERR_QUEUE_RTOS, "queue - Undefined RTOS error") \ + esPrial(21, DEBUG_QUEUE_TIMEOUT, "queue - Timeout") esPrial( \ + 22, ERR_QUEUE_RESOURCE, "queue - Resource not available") \ + esPrial(23, ERR_QUEUE_BADPRM, "queue - Bad parameter") esPrial( \ + 24, ERR_QUEUE_NOMEM, "queue - Out of memory") \ + esPrial(25, ERR_QUEUE_ISR, "queue - Banned in ISR") esPrial( \ + 26, ERR_QUEUE_UNK, "queue - Unknown") \ + \ + esPrial(30, WARN_SCAN_START, "Scan - Already started") \ + esPrial(31, WARN_SCAN_STOP, "Scan - Already stopped") \ + esPrial( \ + 32, \ + ERR_TIMER_START, \ + "Scan - Cannot start timer") \ + esPrial( \ + 33, \ + ERR_TIMER_STOP, \ + "Scan - Cannot stop timer") //[EOT] // Declare list extraction macros -#define ES_ENUM(num, ename, string) ename = num, -#define ES_STRING(num, ename, string) string"\r\n", +#define ES_ENUM(num, ename, string) ename = num, +#define ES_STRING(num, ename, string) string "\r\n", // Build the enum -typedef - enum err { FOREACH_ES(ES_ENUM) } -err_t ; +typedef enum err { FOREACH_ES(ES_ENUM) } err_t; // You need to '#define ERR_C_' in precisely ONE source file #ifdef ERR_C_ - // Build the string list - const char* const wii_errs[] = { FOREACH_ES(ES_STRING) }; +// Build the string list +const char* const wii_errs[] = {FOREACH_ES(ES_STRING)}; #else - // Give access to string list - extern const char* const wii_errs[]; +// Give access to string list +extern const char* const wii_errs[]; #endif // This is a header file, clean up -#undef ES_ENUM -#undef ES_STRING -#undef FOREACH_ES +#undef ES_ENUM +#undef ES_STRING +#undef FOREACH_ES #endif // ERR_H_ diff --git a/applications/plugins/wii_ec_anal/gfx/images.c b/applications/plugins/wii_ec_anal/gfx/images.c index 57046e9a3..e8ab899f7 100644 --- a/applications/plugins/wii_ec_anal/gfx/images.c +++ b/applications/plugins/wii_ec_anal/gfx/images.c @@ -1,55 +1,49 @@ -#include // GUI (screen/keyboard) API +#include // GUI (screen/keyboard) API -#include "images.h" +#include "images.h" //----------------------------------------------------------------------------- ---------------------------------------- -static Canvas* _canvas; -static uint8_t _tlx; -static uint8_t _tly; +static Canvas* _canvas; +static uint8_t _tlx; +static uint8_t _tly; -static uint8_t _x; -static uint8_t _y; +static uint8_t _x; +static uint8_t _y; -static const image_t* _img; +static const image_t* _img; -static bool _blk; -static Color _set; -static Color _clr; +static bool _blk; +static Color _set; +static Color _clr; //+============================================================================ -static -void _showByteSet (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if (b & m) // plot only SET bits - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteSet(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if(b & m) // plot only SET bits + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ -static -void _showByteClr (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if (!(b & m)) // plot only CLR bits - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteClr(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if(!(b & m)) // plot only CLR bits + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ -static -void _showByteAll (const uint8_t b) -{ - for (uint8_t m = 0x80; m; m >>= 1) { - if ((!!(b & m)) ^ _blk) { // Change colour only when required - canvas_set_color(_canvas, ((b & m) ? _set : _clr)); - _blk = !_blk; - } - canvas_draw_dot(_canvas, (_tlx +_x), (_tly +_y)) ; - if ( ((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h) ) break ; - } +static void _showByteAll(const uint8_t b) { + for(uint8_t m = 0x80; m; m >>= 1) { + if((!!(b & m)) ^ _blk) { // Change colour only when required + canvas_set_color(_canvas, ((b & m) ? _set : _clr)); + _blk = !_blk; + } + canvas_draw_dot(_canvas, (_tlx + _x), (_tly + _y)); + if(((++_x) == _img->w) && !(_x = 0) && ((++_y) == _img->h)) break; + } } //+============================================================================ @@ -61,81 +55,83 @@ void _showByteAll (const uint8_t b) // SHOW_ALL - plot all images pixels as they are // SHOW_ALL_INV - plot all images pixels inverted // -void show (Canvas* const canvas, const uint8_t tlx, const uint8_t tly, - const image_t* img, const showMode_t mode) -{ - void(*fnShow)(const uint8_t) = NULL; +void show( + Canvas* const canvas, + const uint8_t tlx, + const uint8_t tly, + const image_t* img, + const showMode_t mode) { + void (*fnShow)(const uint8_t) = NULL; - const uint8_t* bp = img->data; + const uint8_t* bp = img->data; - // code size optimisation - switch (mode & SHOW_INV_) { - case SHOW_NRM_: - _set = ColorBlack; - _clr = ColorWhite; - break; + // code size optimisation + switch(mode & SHOW_INV_) { + case SHOW_NRM_: + _set = ColorBlack; + _clr = ColorWhite; + break; - case SHOW_INV_: - _set = ColorWhite; - _clr = ColorBlack; - break; + case SHOW_INV_: + _set = ColorWhite; + _clr = ColorBlack; + break; - case SHOW_BLK_: - canvas_set_color(canvas, ColorBlack); - break; + case SHOW_BLK_: + canvas_set_color(canvas, ColorBlack); + break; - case SHOW_WHT_: - canvas_set_color(canvas, ColorWhite); - break; + case SHOW_WHT_: + canvas_set_color(canvas, ColorWhite); + break; + } + switch(mode & SHOW_INV_) { + case SHOW_NRM_: + case SHOW_INV_: + fnShow = _showByteAll; + canvas_set_color(canvas, ColorWhite); + _blk = 0; + break; - } - switch (mode & SHOW_INV_) { - case SHOW_NRM_: - case SHOW_INV_: - fnShow = _showByteAll; - canvas_set_color(canvas, ColorWhite); - _blk = 0; - break; + case SHOW_BLK_: + case SHOW_WHT_: + switch(mode & SHOW_ALL_) { + case SHOW_SET_: + fnShow = _showByteSet; + break; + case SHOW_CLR_: + fnShow = _showByteClr; + break; + } + break; + } + furi_check(fnShow); - case SHOW_BLK_: - case SHOW_WHT_: - switch (mode & SHOW_ALL_) { - case SHOW_SET_: - fnShow = _showByteSet; - break; - case SHOW_CLR_: - fnShow = _showByteClr; - break; - } - break; - } - furi_check(fnShow); + // I want nested functions! + _canvas = canvas; + _img = img; + _tlx = tlx; + _tly = tly; + _x = 0; + _y = 0; - // I want nested functions! - _canvas = canvas; - _img = img; - _tlx = tlx; - _tly = tly; - _x = 0; - _y = 0; + // Compressed + if(img->c) { + for(unsigned int i = 0; i < img->len; i++, bp++) { + // Compressed data? {tag, length, value} + if(*bp == img->tag) { + for(uint16_t c = 0; c < bp[1]; c++) fnShow(bp[2]); + bp += 3 - 1; + i += 3 - 1; - // Compressed - if (img->c) { - for (unsigned int i = 0; i < img->len; i++, bp++) { - // Compressed data? {tag, length, value} - if (*bp == img->tag) { - for (uint16_t c = 0; c < bp[1]; c++) fnShow(bp[2]) ; - bp += 3 -1; - i += 3 -1; + // Uncompressed byte + } else { + fnShow(*bp); + } + } - // Uncompressed byte - } else { - fnShow(*bp); - } - } - - // Not compressed - } else { - for (unsigned int i = 0; i < img->len; i++, bp++) fnShow(*bp) ; - } + // Not compressed + } else { + for(unsigned int i = 0; i < img->len; i++, bp++) fnShow(*bp); + } } diff --git a/applications/plugins/wii_ec_anal/gfx/images.h b/applications/plugins/wii_ec_anal/gfx/images.h index 87f2b89b7..d21909176 100644 --- a/applications/plugins/wii_ec_anal/gfx/images.h +++ b/applications/plugins/wii_ec_anal/gfx/images.h @@ -1,134 +1,134 @@ -#ifndef IMAGES_H_ -#define IMAGES_H_ +#ifndef IMAGES_H_ +#define IMAGES_H_ #include #include //----------------------------------------------------------------------------- ---------------------------------------- -typedef - enum showMode { - // {INV:--:WHT:BLK::--:--:CLR:SET} - SHOW_SET_ = 0x01, - SHOW_CLR_ = 0x02, - SHOW_ALL_ = SHOW_SET_ | SHOW_CLR_, +typedef enum showMode { + // {INV:--:WHT:BLK::--:--:CLR:SET} + SHOW_SET_ = 0x01, + SHOW_CLR_ = 0x02, + SHOW_ALL_ = SHOW_SET_ | SHOW_CLR_, - SHOW_BLK_ = 0x10, - SHOW_WHT_ = 0x20, - SHOW_NRM_ = 0x00, - SHOW_INV_ = SHOW_BLK_ | SHOW_WHT_, + SHOW_BLK_ = 0x10, + SHOW_WHT_ = 0x20, + SHOW_NRM_ = 0x00, + SHOW_INV_ = SHOW_BLK_ | SHOW_WHT_, - SHOW_SET_BLK = SHOW_SET_ | SHOW_BLK_, - SHOW_SET_WHT = SHOW_SET_ | SHOW_WHT_, + SHOW_SET_BLK = SHOW_SET_ | SHOW_BLK_, + SHOW_SET_WHT = SHOW_SET_ | SHOW_WHT_, - SHOW_CLR_BLK = SHOW_CLR_ | SHOW_BLK_, - SHOW_CLR_WHT = SHOW_CLR_ | SHOW_WHT_, + SHOW_CLR_BLK = SHOW_CLR_ | SHOW_BLK_, + SHOW_CLR_WHT = SHOW_CLR_ | SHOW_WHT_, - SHOW_ALL = SHOW_ALL_ | SHOW_NRM_, - SHOW_ALL_INV = SHOW_ALL_ | SHOW_INV_, - } -showMode_t; + SHOW_ALL = SHOW_ALL_ | SHOW_NRM_, + SHOW_ALL_INV = SHOW_ALL_ | SHOW_INV_, +} showMode_t; //----------------------------------------------------------------------------- ---------------------------------------- -typedef - struct image { - uint8_t w; // width - uint8_t h; // height - bool c; // compressed? - uint16_t len; // image data length - uint8_t tag; // rle tag - uint8_t data[]; // image data - } -image_t; +typedef struct image { + uint8_t w; // width + uint8_t h; // height + bool c; // compressed? + uint16_t len; // image data length + uint8_t tag; // rle tag + uint8_t data[]; // image data +} image_t; //----------------------------------------------------------------------------- ---------------------------------------- //[TAG] -extern const image_t img_csLogo_Small; -extern const image_t img_3x5_v; -extern const image_t img_3x5_9; -extern const image_t img_3x5_8; -extern const image_t img_3x5_7; -extern const image_t img_3x5_6; -extern const image_t img_3x5_5; -extern const image_t img_3x5_4; -extern const image_t img_3x5_3; -extern const image_t img_3x5_2; -extern const image_t img_3x5_1; -extern const image_t img_3x5_0; -extern const image_t img_key_Ui; -extern const image_t img_key_OKi; -extern const image_t img_RIP; -extern const image_t img_cc_trg_R4; -extern const image_t img_cc_trg_R3; -extern const image_t img_cc_trg_R2; -extern const image_t img_cc_trg_R1; -extern const image_t img_cc_trg_L4; -extern const image_t img_cc_trg_L3; -extern const image_t img_cc_trg_L2; -extern const image_t img_cc_trg_L1; -extern const image_t img_cc_Joy; -extern const image_t img_cc_Main; -extern const image_t img_cc_Cable; -extern const image_t img_key_Back; -extern const image_t img_key_OK; -extern const image_t img_6x8_Z; -extern const image_t img_6x8_Y; -extern const image_t img_6x8_X; -extern const image_t img_key_U; -extern const image_t img_key_D; -extern const image_t img_csLogo_FULL; -extern const image_t img_6x8_7; -extern const image_t img_key_R; -extern const image_t img_key_L; -extern const image_t img_5x7_7; -extern const image_t img_5x7_F; -extern const image_t img_5x7_E; -extern const image_t img_5x7_D; -extern const image_t img_5x7_C; -extern const image_t img_5x7_B; -extern const image_t img_5x7_A; -extern const image_t img_5x7_9; -extern const image_t img_5x7_8; -extern const image_t img_5x7_6; -extern const image_t img_5x7_5; -extern const image_t img_5x7_4; -extern const image_t img_5x7_3; -extern const image_t img_5x7_2; -extern const image_t img_5x7_1; -extern const image_t img_5x7_0; -extern const image_t img_6x8_v; -extern const image_t img_6x8_n; -extern const image_t img_6x8_G; -extern const image_t img_6x8_F; -extern const image_t img_6x8_E; -extern const image_t img_6x8_d; -extern const image_t img_6x8_C; -extern const image_t img_6x8_B; -extern const image_t img_6x8_A; -extern const image_t img_6x8_9; -extern const image_t img_6x8_8; -extern const image_t img_6x8_6; -extern const image_t img_6x8_5; -extern const image_t img_6x8_4; -extern const image_t img_6x8_3; -extern const image_t img_6x8_2; -extern const image_t img_6x8_1; -extern const image_t img_6x8_0; -extern const image_t img_ecp_SDA; -extern const image_t img_ecp_SCL; -extern const image_t img_ecp_port; -extern const image_t img_cc_pad_UD1; -extern const image_t img_cc_pad_LR1; -extern const image_t img_cc_btn_Y1; -extern const image_t img_cc_btn_X1; -extern const image_t img_cc_btn_B1; -extern const image_t img_cc_btn_A1; -extern const image_t img_6x8_D; +extern const image_t img_csLogo_Small; +extern const image_t img_3x5_v; +extern const image_t img_3x5_9; +extern const image_t img_3x5_8; +extern const image_t img_3x5_7; +extern const image_t img_3x5_6; +extern const image_t img_3x5_5; +extern const image_t img_3x5_4; +extern const image_t img_3x5_3; +extern const image_t img_3x5_2; +extern const image_t img_3x5_1; +extern const image_t img_3x5_0; +extern const image_t img_key_Ui; +extern const image_t img_key_OKi; +extern const image_t img_RIP; +extern const image_t img_cc_trg_R4; +extern const image_t img_cc_trg_R3; +extern const image_t img_cc_trg_R2; +extern const image_t img_cc_trg_R1; +extern const image_t img_cc_trg_L4; +extern const image_t img_cc_trg_L3; +extern const image_t img_cc_trg_L2; +extern const image_t img_cc_trg_L1; +extern const image_t img_cc_Joy; +extern const image_t img_cc_Main; +extern const image_t img_cc_Cable; +extern const image_t img_key_Back; +extern const image_t img_key_OK; +extern const image_t img_6x8_Z; +extern const image_t img_6x8_Y; +extern const image_t img_6x8_X; +extern const image_t img_key_U; +extern const image_t img_key_D; +extern const image_t img_csLogo_FULL; +extern const image_t img_6x8_7; +extern const image_t img_key_R; +extern const image_t img_key_L; +extern const image_t img_5x7_7; +extern const image_t img_5x7_F; +extern const image_t img_5x7_E; +extern const image_t img_5x7_D; +extern const image_t img_5x7_C; +extern const image_t img_5x7_B; +extern const image_t img_5x7_A; +extern const image_t img_5x7_9; +extern const image_t img_5x7_8; +extern const image_t img_5x7_6; +extern const image_t img_5x7_5; +extern const image_t img_5x7_4; +extern const image_t img_5x7_3; +extern const image_t img_5x7_2; +extern const image_t img_5x7_1; +extern const image_t img_5x7_0; +extern const image_t img_6x8_v; +extern const image_t img_6x8_n; +extern const image_t img_6x8_G; +extern const image_t img_6x8_F; +extern const image_t img_6x8_E; +extern const image_t img_6x8_d; +extern const image_t img_6x8_C; +extern const image_t img_6x8_B; +extern const image_t img_6x8_A; +extern const image_t img_6x8_9; +extern const image_t img_6x8_8; +extern const image_t img_6x8_6; +extern const image_t img_6x8_5; +extern const image_t img_6x8_4; +extern const image_t img_6x8_3; +extern const image_t img_6x8_2; +extern const image_t img_6x8_1; +extern const image_t img_6x8_0; +extern const image_t img_ecp_SDA; +extern const image_t img_ecp_SCL; +extern const image_t img_ecp_port; +extern const image_t img_cc_pad_UD1; +extern const image_t img_cc_pad_LR1; +extern const image_t img_cc_btn_Y1; +extern const image_t img_cc_btn_X1; +extern const image_t img_cc_btn_B1; +extern const image_t img_cc_btn_A1; +extern const image_t img_6x8_D; //----------------------------------------------------------------------------- ---------------------------------------- #ifndef IMGTEST -# include - void show (Canvas* const canvas, const uint8_t tlx, const uint8_t tly, - const image_t* img, const showMode_t mode) ; +#include +void show( + Canvas* const canvas, + const uint8_t tlx, + const uint8_t tly, + const image_t* img, + const showMode_t mode); #endif #endif //IMAGES_H_ diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_0.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_0.c index 975d98d35..8fc8e0e14 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_0.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_0.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_0 = { 3, 5, false, 2, 0, { - 0xF6, 0xDE -}}; +const image_t img_3x5_0 = {3, 5, false, 2, 0, {0xF6, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_1.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_1.c index 0d9dc3fe4..8b7d4cf80 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_1.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_1 = { 3, 5, false, 2, 0, { - 0xC9, 0x2E -}}; +const image_t img_3x5_1 = {3, 5, false, 2, 0, {0xC9, 0x2E}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_2.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_2.c index d98bf4e93..89a81c75e 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_2.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_2.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_2 = { 3, 5, false, 2, 0, { - 0xE7, 0xCE -}}; +const image_t img_3x5_2 = {3, 5, false, 2, 0, {0xE7, 0xCE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_3.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_3.c index 8d08ed1b6..97ff0478a 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_3.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_3.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_3 = { 3, 5, false, 2, 0, { - 0xE5, 0x9E -}}; +const image_t img_3x5_3 = {3, 5, false, 2, 0, {0xE5, 0x9E}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_4.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_4.c index 795e9b76f..2bbd9ef42 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_4.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_4.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_4 = { 3, 5, false, 2, 0, { - 0x97, 0x92 -}}; +const image_t img_3x5_4 = {3, 5, false, 2, 0, {0x97, 0x92}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_5.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_5.c index 377853507..e0466f37a 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_5.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_5.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_5 = { 3, 5, false, 2, 0, { - 0xF3, 0x9E -}}; +const image_t img_3x5_5 = {3, 5, false, 2, 0, {0xF3, 0x9E}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_6.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_6.c index d3af64071..1b62caf72 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_6.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_6.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_6 = { 3, 5, false, 2, 0, { - 0xD3, 0xDE -}}; +const image_t img_3x5_6 = {3, 5, false, 2, 0, {0xD3, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_7.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_7.c index 2c3b1e0b9..acfe57cf8 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_7.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_7.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_7 = { 3, 5, false, 2, 0, { - 0xE5, 0x24 -}}; +const image_t img_3x5_7 = {3, 5, false, 2, 0, {0xE5, 0x24}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_8.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_8.c index 5cb6d3354..31f32af52 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_8.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_8.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_8 = { 3, 5, false, 2, 0, { - 0xF7, 0xDE -}}; +const image_t img_3x5_8 = {3, 5, false, 2, 0, {0xF7, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_9.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_9.c index ee5e82b87..4b1ba1e09 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_9.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_9.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_9 = { 3, 5, false, 2, 0, { - 0xF7, 0x96 -}}; +const image_t img_3x5_9 = {3, 5, false, 2, 0, {0xF7, 0x96}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_3x5_v.c b/applications/plugins/wii_ec_anal/gfx/img_3x5_v.c index dcf3f631d..2282e1697 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_3x5_v.c +++ b/applications/plugins/wii_ec_anal/gfx/img_3x5_v.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_3x5_v = { 3, 5, false, 2, 0, { - 0x02, 0xD4 -}}; +const image_t img_3x5_v = {3, 5, false, 2, 0, {0x02, 0xD4}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_0.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_0.c index c59852f19..7ae2186b3 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_0.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_0.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_0 = { 5, 7, false, 5, 0, { - 0x74, 0x67, 0x5C, 0xC5, 0xC0 -}}; +const image_t img_5x7_0 = {5, 7, false, 5, 0, {0x74, 0x67, 0x5C, 0xC5, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_1.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_1.c index 4bd08f89c..c1a9cec74 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_1 = { 5, 7, false, 5, 0, { - 0x65, 0x08, 0x42, 0x13, 0xE0 -}}; +const image_t img_5x7_1 = {5, 7, false, 5, 0, {0x65, 0x08, 0x42, 0x13, 0xE0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_2.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_2.c index 1270393f7..7fab90010 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_2.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_2.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_2 = { 5, 7, false, 5, 0, { - 0x74, 0x42, 0x22, 0x23, 0xE0 -}}; +const image_t img_5x7_2 = {5, 7, false, 5, 0, {0x74, 0x42, 0x22, 0x23, 0xE0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_3.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_3.c index e26bac523..2099bf795 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_3.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_3.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_3 = { 5, 7, false, 5, 0, { - 0x74, 0x42, 0x60, 0xC5, 0xC0 -}}; +const image_t img_5x7_3 = {5, 7, false, 5, 0, {0x74, 0x42, 0x60, 0xC5, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_4.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_4.c index e0dc5687f..1eee4f07d 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_4.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_4.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_4 = { 5, 7, false, 5, 0, { - 0x84, 0x25, 0x2F, 0x88, 0x40 -}}; +const image_t img_5x7_4 = {5, 7, false, 5, 0, {0x84, 0x25, 0x2F, 0x88, 0x40}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_5.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_5.c index 81747376f..be1e54681 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_5.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_5.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_5 = { 5, 7, false, 5, 0, { - 0xFC, 0x21, 0xE0, 0x87, 0xC0 -}}; +const image_t img_5x7_5 = {5, 7, false, 5, 0, {0xFC, 0x21, 0xE0, 0x87, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_6.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_6.c index 455c874dc..da155c1b5 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_6.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_6.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_6 = { 5, 7, false, 5, 0, { - 0x74, 0x21, 0xE8, 0xC5, 0xC0 -}}; +const image_t img_5x7_6 = {5, 7, false, 5, 0, {0x74, 0x21, 0xE8, 0xC5, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_7.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_7.c index 73e813a21..fde7e8ea2 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_7.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_7.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_7 = { 5, 7, false, 5, 0, { - 0xF8, 0x44, 0x22, 0x10, 0x80 -}}; +const image_t img_5x7_7 = {5, 7, false, 5, 0, {0xF8, 0x44, 0x22, 0x10, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_8.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_8.c index 0f04a48bf..aff178282 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_8.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_8.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_8 = { 5, 7, false, 5, 0, { - 0x74, 0x62, 0xE8, 0xC5, 0xC0 -}}; +const image_t img_5x7_8 = {5, 7, false, 5, 0, {0x74, 0x62, 0xE8, 0xC5, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_9.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_9.c index 2b1e978c6..2417c57e8 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_9.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_9.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_9 = { 5, 7, false, 5, 0, { - 0x74, 0x62, 0xF0, 0x85, 0xC0 -}}; +const image_t img_5x7_9 = {5, 7, false, 5, 0, {0x74, 0x62, 0xF0, 0x85, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_A.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_A.c index a6b049f01..910c034a2 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_A.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_A.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_A = { 5, 7, false, 5, 0, { - 0x74, 0x63, 0xF8, 0xC6, 0x20 -}}; +const image_t img_5x7_A = {5, 7, false, 5, 0, {0x74, 0x63, 0xF8, 0xC6, 0x20}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_B.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_B.c index 06b36599c..93808fee2 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_B.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_B.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_B = { 5, 7, false, 5, 0, { - 0xF4, 0x63, 0x68, 0xC7, 0xC0 -}}; +const image_t img_5x7_B = {5, 7, false, 5, 0, {0xF4, 0x63, 0x68, 0xC7, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_C.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_C.c index c058d09a9..1438eaf44 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_C.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_C.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_C = { 5, 7, false, 5, 0, { - 0x74, 0x61, 0x08, 0x45, 0xC0 -}}; +const image_t img_5x7_C = {5, 7, false, 5, 0, {0x74, 0x61, 0x08, 0x45, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_D.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_D.c index 3425e3648..9c6b590ee 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_D.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_D.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_D = { 5, 7, false, 5, 0, { - 0x75, 0x4A, 0x52, 0xD5, 0xC0 -}}; +const image_t img_5x7_D = {5, 7, false, 5, 0, {0x75, 0x4A, 0x52, 0xD5, 0xC0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_E.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_E.c index c7bbc301a..bc15fb240 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_E.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_E.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_E = { 5, 7, false, 5, 0, { - 0xFC, 0x21, 0xC8, 0x43, 0xE0 -}}; +const image_t img_5x7_E = {5, 7, false, 5, 0, {0xFC, 0x21, 0xC8, 0x43, 0xE0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_5x7_F.c b/applications/plugins/wii_ec_anal/gfx/img_5x7_F.c index 440c37eae..e4ad0db69 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_5x7_F.c +++ b/applications/plugins/wii_ec_anal/gfx/img_5x7_F.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_5x7_F = { 5, 7, false, 5, 0, { - 0xFC, 0x21, 0xC8, 0x42, 0x00 -}}; +const image_t img_5x7_F = {5, 7, false, 5, 0, {0xFC, 0x21, 0xC8, 0x42, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_0.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_0.c index b8b4c7d9a..952cf34d8 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_0.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_0.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_0 = { 6, 8, false, 6, 0, { - 0x7B, 0xFC, 0xF3, 0xCF, 0x3F, 0xDE -}}; +const image_t img_6x8_0 = {6, 8, false, 6, 0, {0x7B, 0xFC, 0xF3, 0xCF, 0x3F, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_1.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_1.c index 91e2b2cfa..846a6876c 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_1.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_1 = { 6, 8, false, 6, 0, { - 0x73, 0xC3, 0x0C, 0x30, 0xCF, 0xFF -}}; +const image_t img_6x8_1 = {6, 8, false, 6, 0, {0x73, 0xC3, 0x0C, 0x30, 0xCF, 0xFF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_2.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_2.c index 7d24c64d6..4534bb67c 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_2.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_2.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_2 = { 6, 8, false, 6, 0, { - 0x7B, 0xF0, 0xC7, 0x31, 0x8F, 0xFF -}}; +const image_t img_6x8_2 = {6, 8, false, 6, 0, {0x7B, 0xF0, 0xC7, 0x31, 0x8F, 0xFF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_3.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_3.c index 3a8f9f211..7e79eb03a 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_3.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_3.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_3 = { 6, 8, false, 6, 0, { - 0x7B, 0xF0, 0xCF, 0x3C, 0x3F, 0xDE -}}; +const image_t img_6x8_3 = {6, 8, false, 6, 0, {0x7B, 0xF0, 0xCF, 0x3C, 0x3F, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_4.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_4.c index c5ae9efef..324b036ce 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_4.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_4.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_4 = { 6, 8, false, 6, 0, { - 0xC3, 0x0D, 0xB6, 0xFF, 0xF1, 0x86 -}}; +const image_t img_6x8_4 = {6, 8, false, 6, 0, {0xC3, 0x0D, 0xB6, 0xFF, 0xF1, 0x86}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_5.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_5.c index 787e39ea6..cdfda5f2b 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_5.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_5.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_5 = { 6, 8, false, 6, 0, { - 0xFF, 0xFC, 0x3E, 0xFC, 0x3F, 0xFE -}}; +const image_t img_6x8_5 = {6, 8, false, 6, 0, {0xFF, 0xFC, 0x3E, 0xFC, 0x3F, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_6.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_6.c index 8f07f1bfc..781a060f1 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_6.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_6.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_6 = { 6, 8, false, 6, 0, { - 0x7B, 0xEC, 0x3E, 0xFF, 0x3F, 0xDE -}}; +const image_t img_6x8_6 = {6, 8, false, 6, 0, {0x7B, 0xEC, 0x3E, 0xFF, 0x3F, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_7.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_7.c index cad50c65d..fec5f4bf4 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_7.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_7.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_7 = { 6, 8, false, 6, 0, { - 0xFF, 0xF0, 0xC6, 0x18, 0xC3, 0x0C -}}; +const image_t img_6x8_7 = {6, 8, false, 6, 0, {0xFF, 0xF0, 0xC6, 0x18, 0xC3, 0x0C}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_8.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_8.c index a38b2110d..a5b21c375 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_8.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_8.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_8 = { 6, 8, false, 6, 0, { - 0x7B, 0xFC, 0xDE, 0xFF, 0x3F, 0xDE -}}; +const image_t img_6x8_8 = {6, 8, false, 6, 0, {0x7B, 0xFC, 0xDE, 0xFF, 0x3F, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_9.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_9.c index b740c7f90..f7707c0df 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_9.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_9.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_9 = { 6, 8, false, 6, 0, { - 0x7B, 0xFC, 0xFF, 0x7C, 0x37, 0xDE -}}; +const image_t img_6x8_9 = {6, 8, false, 6, 0, {0x7B, 0xFC, 0xFF, 0x7C, 0x37, 0xDE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_A.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_A.c index fa3aed598..1bb65c902 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_A.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_A.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_A = { 6, 8, false, 6, 0, { - 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3 -}}; +const image_t img_6x8_A = {6, 8, false, 6, 0, {0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_B.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_B.c index 14c1e28c6..00e012d53 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_B.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_B.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_B = { 6, 8, false, 6, 0, { - 0xFB, 0xFC, 0xFE, 0xFB, 0x3F, 0xFE -}}; +const image_t img_6x8_B = {6, 8, false, 6, 0, {0xFB, 0xFC, 0xFE, 0xFB, 0x3F, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_C.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_C.c index 6d8f7aa32..694901009 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_C.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_C.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_C = { 6, 8, false, 6, 0, { - 0x7F, 0xFC, 0x30, 0xC3, 0x0F, 0xDF -}}; +const image_t img_6x8_C = {6, 8, false, 6, 0, {0x7F, 0xFC, 0x30, 0xC3, 0x0F, 0xDF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_D.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_D.c index 474e4a235..a95e760eb 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_D.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_D.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_D = { 6, 8, false, 6, 0, { - 0xFB, 0xF6, 0xDB, 0x6D, 0xBF, 0xFE -}}; +const image_t img_6x8_D = {6, 8, false, 6, 0, {0xFB, 0xF6, 0xDB, 0x6D, 0xBF, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_E.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_E.c index 00f2cb559..f49503f00 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_E.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_E.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_E = { 6, 8, false, 6, 0, { - 0xFF, 0xFC, 0x3C, 0xF3, 0x0F, 0xFF -}}; +const image_t img_6x8_E = {6, 8, false, 6, 0, {0xFF, 0xFC, 0x3C, 0xF3, 0x0F, 0xFF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_F.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_F.c index 8958a0419..0037b2544 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_F.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_F.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_F = { 6, 8, false, 6, 0, { - 0xFF, 0xFC, 0x3C, 0xF3, 0x0C, 0x30 -}}; +const image_t img_6x8_F = {6, 8, false, 6, 0, {0xFF, 0xFC, 0x3C, 0xF3, 0x0C, 0x30}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_G.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_G.c index f5e8f03f4..f30bc9952 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_G.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_G.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_G = { 6, 8, false, 6, 0, { - 0x7F, 0xFC, 0x30, 0xDF, 0x3F, 0xDF -}}; +const image_t img_6x8_G = {6, 8, false, 6, 0, {0x7F, 0xFC, 0x30, 0xDF, 0x3F, 0xDF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_X.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_X.c index 7b162baf3..4735e82a1 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_X.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_X.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_X = { 6, 8, false, 6, 0, { - 0xCF, 0x36, 0x8E, 0x71, 0x6C, 0xF3 -}}; +const image_t img_6x8_X = {6, 8, false, 6, 0, {0xCF, 0x36, 0x8E, 0x71, 0x6C, 0xF3}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_Y.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_Y.c index b39392948..508e786bd 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_Y.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_Y.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_Y = { 6, 8, false, 6, 0, { - 0xCF, 0x3C, 0xF3, 0x78, 0xC3, 0x0C -}}; +const image_t img_6x8_Y = {6, 8, false, 6, 0, {0xCF, 0x3C, 0xF3, 0x78, 0xC3, 0x0C}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_Z.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_Z.c index 9904d08b4..c42d560ac 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_Z.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_Z.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_Z = { 6, 8, false, 6, 0, { - 0xFF, 0xF0, 0xC6, 0x31, 0x8F, 0xFF -}}; +const image_t img_6x8_Z = {6, 8, false, 6, 0, {0xFF, 0xF0, 0xC6, 0x31, 0x8F, 0xFF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_d_.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_d_.c index 2a00713fd..1f8123a6c 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_d_.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_d_.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_d = { 6, 8, false, 6, 0, { - 0x0C, 0x30, 0xDF, 0xFF, 0x3F, 0xDF -}}; +const image_t img_6x8_d = {6, 8, false, 6, 0, {0x0C, 0x30, 0xDF, 0xFF, 0x3F, 0xDF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_n_.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_n_.c index 086bdd2de..15d403d28 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_n_.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_n_.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_n = { 6, 8, false, 6, 0, { - 0x00, 0x07, 0xBF, 0xCF, 0x3C, 0xF3 -}}; +const image_t img_6x8_n = {6, 8, false, 6, 0, {0x00, 0x07, 0xBF, 0xCF, 0x3C, 0xF3}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_6x8_v_.c b/applications/plugins/wii_ec_anal/gfx/img_6x8_v_.c index c897aadff..1229701a1 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_6x8_v_.c +++ b/applications/plugins/wii_ec_anal/gfx/img_6x8_v_.c @@ -9,6 +9,4 @@ #include "images.h" -const image_t img_6x8_v = { 6, 8, false, 6, 0, { - 0x00, 0x08, 0x73, 0xCF, 0xF7, 0x8C -}}; +const image_t img_6x8_v = {6, 8, false, 6, 0, {0x00, 0x08, 0x73, 0xCF, 0xF7, 0x8C}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_RIP.c b/applications/plugins/wii_ec_anal/gfx/img_RIP.c index 55cb7bfc2..c20877ef0 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_RIP.c +++ b/applications/plugins/wii_ec_anal/gfx/img_RIP.c @@ -65,58 +65,66 @@ #include "images.h" -const image_t img_RIP = { 128, 64, true, 837, 0x06, { // orig:1024, comp:18.26% - 0x06, 0x20, 0xFF, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xD4, 0x06, 0x0E, 0x00, 0x2B, 0xC8, 0x01, 0xFC, - 0x1E, 0x1F, 0xF0, 0x00, 0xFE, 0x20, 0x8F, 0xE3, 0xF8, 0xFE, 0x3F, 0x80, 0x13, 0xD4, 0x01, 0xFC, - 0x0E, 0x0F, 0xF0, 0x00, 0xFE, 0x71, 0xCF, 0xE3, 0xF8, 0xFE, 0x3F, 0x80, 0x2B, 0xC0, 0x00, 0x0E, - 0x0A, 0x00, 0x38, 0x01, 0x87, 0x71, 0xD8, 0x77, 0x1C, 0x07, 0x71, 0xC0, 0x03, 0xC0, 0x03, 0x8E, - 0x0A, 0x0E, 0x28, 0x01, 0xC5, 0x51, 0x5C, 0x77, 0x1D, 0xC7, 0x71, 0x40, 0x03, 0xC0, 0x03, 0x8A, - 0x0A, 0x0E, 0x28, 0x01, 0x47, 0x51, 0x5C, 0x55, 0x15, 0xC5, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x8A, - 0x0A, 0x0A, 0x28, 0x01, 0x40, 0x51, 0x54, 0x55, 0x15, 0x45, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x8A, - 0x0A, 0x0A, 0x28, 0x01, 0x40, 0x51, 0x54, 0x55, 0x15, 0x45, 0x51, 0xC0, 0x03, 0xC0, 0x02, 0x8E, - 0x0A, 0x0A, 0x38, 0x01, 0x40, 0x51, 0x54, 0x75, 0x55, 0x47, 0x50, 0x00, 0x03, 0xC0, 0x02, 0xF8, - 0x0A, 0x0B, 0xE0, 0x01, 0x40, 0x71, 0xD7, 0xC5, 0x15, 0x7C, 0x50, 0x00, 0x03, 0xC0, 0x02, 0xF8, - 0x0A, 0x0B, 0xE0, 0x01, 0x40, 0x3F, 0x97, 0xC5, 0x15, 0x7C, 0x57, 0x80, 0x03, 0xC0, 0x02, 0x9C, - 0x0A, 0x0A, 0x00, 0x01, 0x40, 0x1B, 0x14, 0x75, 0x55, 0x4E, 0x57, 0xC0, 0x03, 0xC0, 0x02, 0x94, - 0x0A, 0x0A, 0x00, 0x01, 0x40, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x94, - 0x0A, 0x0A, 0x00, 0x01, 0x40, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x94, - 0x0A, 0x0A, 0x00, 0x01, 0xC7, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x71, 0x40, 0x03, 0xC0, 0x02, 0x94, - 0x0A, 0x0A, 0x00, 0x01, 0xC5, 0x0A, 0x1C, 0x77, 0x1D, 0x4A, 0x71, 0x40, 0x03, 0xC0, 0x02, 0x94, - 0x0A, 0x0A, 0x00, 0x01, 0x87, 0x0E, 0x1C, 0x77, 0x1D, 0x4A, 0x61, 0xC0, 0x03, 0xC0, 0x03, 0x9C, - 0xCE, 0xCE, 0xC0, 0x00, 0xFE, 0x0E, 0x0F, 0xE3, 0xF9, 0xCE, 0x3F, 0x80, 0x03, 0xC0, 0x03, 0x8E, - 0xDE, 0xDE, 0xC0, 0x00, 0xFE, 0x1F, 0x0F, 0xE3, 0xF9, 0xC7, 0x3F, 0x80, 0x03, 0xC0, 0x06, 0x0E, - 0x00, 0x03, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x06, 0x0A, 0x00, 0x01, 0x8C, 0x07, 0xF0, 0x03, - 0xC0, 0x06, 0x07, 0x00, 0x04, 0x00, 0x00, 0x02, 0x52, 0x18, 0x0C, 0x03, 0xC1, 0xD5, 0xC7, 0x57, - 0x77, 0x6D, 0xC4, 0x5D, 0x2B, 0x8E, 0xE0, 0x03, 0x5A, 0x20, 0x02, 0x03, 0xC0, 0x95, 0x04, 0x54, - 0x24, 0x55, 0x04, 0x55, 0xA1, 0x0A, 0x80, 0x01, 0x8C, 0x47, 0xC1, 0x03, 0xC0, 0x9D, 0x87, 0x27, - 0x26, 0x55, 0xC5, 0x55, 0x61, 0x0C, 0xC0, 0x00, 0x50, 0x88, 0x21, 0x03, 0xC0, 0x95, 0x01, 0x21, - 0x24, 0x44, 0x45, 0x55, 0x21, 0x0A, 0x80, 0x00, 0x20, 0x90, 0x11, 0x03, 0xC0, 0x95, 0xC7, 0x27, - 0x27, 0x45, 0xC6, 0xDD, 0x21, 0x0E, 0xE0, 0x00, 0x70, 0x91, 0x91, 0x03, 0xC0, 0x06, 0x0B, 0x00, - 0x88, 0x92, 0x51, 0x03, 0xC0, 0x06, 0x0A, 0x00, 0x01, 0x08, 0x92, 0x91, 0x03, 0xC0, 0x06, 0x0A, - 0x00, 0x01, 0x08, 0x92, 0x11, 0x03, 0xC1, 0xD5, 0xC7, 0x76, 0xDC, 0x45, 0xDD, 0x5D, 0x5C, 0x57, - 0x50, 0x00, 0x87, 0x11, 0xE2, 0x03, 0xC0, 0x95, 0x04, 0x55, 0x50, 0x44, 0x89, 0x55, 0x48, 0x55, - 0x50, 0x00, 0x80, 0x88, 0x03, 0x03, 0xC0, 0x9D, 0x87, 0x75, 0x58, 0x54, 0x89, 0xD5, 0x48, 0x25, - 0x50, 0x00, 0x40, 0x7C, 0x04, 0x83, 0xC0, 0x95, 0x01, 0x54, 0x50, 0x54, 0x89, 0x55, 0x48, 0x25, - 0x50, 0x00, 0x40, 0x07, 0xF8, 0x43, 0xC0, 0x95, 0xC7, 0x54, 0x5C, 0x6D, 0xC9, 0x5D, 0xC8, 0x27, - 0x70, 0x00, 0x30, 0x00, 0x00, 0x43, 0xC0, 0x06, 0x0B, 0x00, 0x0F, 0xFF, 0xFF, 0x83, 0xC0, 0x06, - 0x0E, 0x00, 0x03, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x00, 0x07, 0xC7, 0xF1, 0xFC, 0x7F, 0x00, - 0x03, 0xF8, 0xFE, 0x3F, 0x8F, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x07, 0xC7, 0xF1, 0xFC, 0x7F, 0x00, - 0x03, 0xF8, 0xFE, 0x3F, 0x8F, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x05, 0x4E, 0x3B, 0x8E, 0xE3, 0x80, - 0x07, 0x1D, 0xC7, 0x71, 0xDC, 0x70, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4E, 0x3A, 0x8E, 0xE3, 0x80, - 0x05, 0x15, 0xC7, 0x51, 0x54, 0x50, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4A, 0x2B, 0x8A, 0xA2, 0x80, - 0x07, 0x15, 0x45, 0x71, 0x5C, 0x50, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4A, 0x28, 0x0A, 0xA2, 0x80, - 0x00, 0x15, 0x45, 0x01, 0x40, 0x50, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4A, 0x28, 0x0A, 0xA6, 0x80, - 0x00, 0x15, 0x4D, 0x01, 0x40, 0x50, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4E, 0x28, 0x0E, 0xA6, 0x80, - 0x00, 0x1D, 0x4D, 0x01, 0xC0, 0x70, 0x00, 0x03, 0xC0, 0x00, 0x01, 0xC3, 0xE8, 0x0E, 0xAA, 0x9F, - 0xE1, 0xF9, 0x55, 0x1F, 0x87, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x01, 0xC3, 0xE8, 0x38, 0xAA, 0x90, - 0x23, 0xF1, 0x55, 0x3F, 0x0F, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x38, 0xB2, 0x9F, - 0xE7, 0x01, 0x65, 0x70, 0x1C, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, 0xB2, 0x80, - 0x05, 0x01, 0x65, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, 0xA2, 0x80, - 0x05, 0x01, 0x45, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, 0xA2, 0x80, - 0x05, 0x01, 0x45, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x38, 0x28, 0xE3, 0x80, - 0x05, 0x01, 0xC7, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x38, 0x28, 0xE3, 0x80, - 0x05, 0x0D, 0xC7, 0x50, 0xD4, 0x30, 0x00, 0x03, 0xD4, 0x00, 0x07, 0xF3, 0xF0, 0x38, 0x7F, 0x00, - 0x07, 0xFC, 0xFE, 0x7F, 0xDF, 0xF0, 0x00, 0x2B, 0xC8, 0x00, 0x0F, 0xFB, 0xF0, 0x38, 0x7F, 0x00, - 0x07, 0xFC, 0xFE, 0x7F, 0xDF, 0xF0, 0x00, 0x13, 0xD4, 0x06, 0x0E, 0x00, 0x2B, 0xC0, 0x06, 0x0E, - 0x00, 0x03, 0x06, 0x20, 0xFF -}}; +const image_t img_RIP = { + 128, + 64, + true, + 837, + 0x06, + {// orig:1024, comp:18.26% + 0x06, 0x20, 0xFF, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xD4, 0x06, 0x0E, 0x00, 0x2B, 0xC8, 0x01, + 0xFC, 0x1E, 0x1F, 0xF0, 0x00, 0xFE, 0x20, 0x8F, 0xE3, 0xF8, 0xFE, 0x3F, 0x80, 0x13, 0xD4, + 0x01, 0xFC, 0x0E, 0x0F, 0xF0, 0x00, 0xFE, 0x71, 0xCF, 0xE3, 0xF8, 0xFE, 0x3F, 0x80, 0x2B, + 0xC0, 0x00, 0x0E, 0x0A, 0x00, 0x38, 0x01, 0x87, 0x71, 0xD8, 0x77, 0x1C, 0x07, 0x71, 0xC0, + 0x03, 0xC0, 0x03, 0x8E, 0x0A, 0x0E, 0x28, 0x01, 0xC5, 0x51, 0x5C, 0x77, 0x1D, 0xC7, 0x71, + 0x40, 0x03, 0xC0, 0x03, 0x8A, 0x0A, 0x0E, 0x28, 0x01, 0x47, 0x51, 0x5C, 0x55, 0x15, 0xC5, + 0x51, 0x40, 0x03, 0xC0, 0x02, 0x8A, 0x0A, 0x0A, 0x28, 0x01, 0x40, 0x51, 0x54, 0x55, 0x15, + 0x45, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x8A, 0x0A, 0x0A, 0x28, 0x01, 0x40, 0x51, 0x54, 0x55, + 0x15, 0x45, 0x51, 0xC0, 0x03, 0xC0, 0x02, 0x8E, 0x0A, 0x0A, 0x38, 0x01, 0x40, 0x51, 0x54, + 0x75, 0x55, 0x47, 0x50, 0x00, 0x03, 0xC0, 0x02, 0xF8, 0x0A, 0x0B, 0xE0, 0x01, 0x40, 0x71, + 0xD7, 0xC5, 0x15, 0x7C, 0x50, 0x00, 0x03, 0xC0, 0x02, 0xF8, 0x0A, 0x0B, 0xE0, 0x01, 0x40, + 0x3F, 0x97, 0xC5, 0x15, 0x7C, 0x57, 0x80, 0x03, 0xC0, 0x02, 0x9C, 0x0A, 0x0A, 0x00, 0x01, + 0x40, 0x1B, 0x14, 0x75, 0x55, 0x4E, 0x57, 0xC0, 0x03, 0xC0, 0x02, 0x94, 0x0A, 0x0A, 0x00, + 0x01, 0x40, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x94, 0x0A, 0x0A, + 0x00, 0x01, 0x40, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x51, 0x40, 0x03, 0xC0, 0x02, 0x94, 0x0A, + 0x0A, 0x00, 0x01, 0xC7, 0x0A, 0x14, 0x55, 0x15, 0x4A, 0x71, 0x40, 0x03, 0xC0, 0x02, 0x94, + 0x0A, 0x0A, 0x00, 0x01, 0xC5, 0x0A, 0x1C, 0x77, 0x1D, 0x4A, 0x71, 0x40, 0x03, 0xC0, 0x02, + 0x94, 0x0A, 0x0A, 0x00, 0x01, 0x87, 0x0E, 0x1C, 0x77, 0x1D, 0x4A, 0x61, 0xC0, 0x03, 0xC0, + 0x03, 0x9C, 0xCE, 0xCE, 0xC0, 0x00, 0xFE, 0x0E, 0x0F, 0xE3, 0xF9, 0xCE, 0x3F, 0x80, 0x03, + 0xC0, 0x03, 0x8E, 0xDE, 0xDE, 0xC0, 0x00, 0xFE, 0x1F, 0x0F, 0xE3, 0xF9, 0xC7, 0x3F, 0x80, + 0x03, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x06, 0x0A, 0x00, + 0x01, 0x8C, 0x07, 0xF0, 0x03, 0xC0, 0x06, 0x07, 0x00, 0x04, 0x00, 0x00, 0x02, 0x52, 0x18, + 0x0C, 0x03, 0xC1, 0xD5, 0xC7, 0x57, 0x77, 0x6D, 0xC4, 0x5D, 0x2B, 0x8E, 0xE0, 0x03, 0x5A, + 0x20, 0x02, 0x03, 0xC0, 0x95, 0x04, 0x54, 0x24, 0x55, 0x04, 0x55, 0xA1, 0x0A, 0x80, 0x01, + 0x8C, 0x47, 0xC1, 0x03, 0xC0, 0x9D, 0x87, 0x27, 0x26, 0x55, 0xC5, 0x55, 0x61, 0x0C, 0xC0, + 0x00, 0x50, 0x88, 0x21, 0x03, 0xC0, 0x95, 0x01, 0x21, 0x24, 0x44, 0x45, 0x55, 0x21, 0x0A, + 0x80, 0x00, 0x20, 0x90, 0x11, 0x03, 0xC0, 0x95, 0xC7, 0x27, 0x27, 0x45, 0xC6, 0xDD, 0x21, + 0x0E, 0xE0, 0x00, 0x70, 0x91, 0x91, 0x03, 0xC0, 0x06, 0x0B, 0x00, 0x88, 0x92, 0x51, 0x03, + 0xC0, 0x06, 0x0A, 0x00, 0x01, 0x08, 0x92, 0x91, 0x03, 0xC0, 0x06, 0x0A, 0x00, 0x01, 0x08, + 0x92, 0x11, 0x03, 0xC1, 0xD5, 0xC7, 0x76, 0xDC, 0x45, 0xDD, 0x5D, 0x5C, 0x57, 0x50, 0x00, + 0x87, 0x11, 0xE2, 0x03, 0xC0, 0x95, 0x04, 0x55, 0x50, 0x44, 0x89, 0x55, 0x48, 0x55, 0x50, + 0x00, 0x80, 0x88, 0x03, 0x03, 0xC0, 0x9D, 0x87, 0x75, 0x58, 0x54, 0x89, 0xD5, 0x48, 0x25, + 0x50, 0x00, 0x40, 0x7C, 0x04, 0x83, 0xC0, 0x95, 0x01, 0x54, 0x50, 0x54, 0x89, 0x55, 0x48, + 0x25, 0x50, 0x00, 0x40, 0x07, 0xF8, 0x43, 0xC0, 0x95, 0xC7, 0x54, 0x5C, 0x6D, 0xC9, 0x5D, + 0xC8, 0x27, 0x70, 0x00, 0x30, 0x00, 0x00, 0x43, 0xC0, 0x06, 0x0B, 0x00, 0x0F, 0xFF, 0xFF, + 0x83, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0xC0, 0x00, 0x07, 0xC7, + 0xF1, 0xFC, 0x7F, 0x00, 0x03, 0xF8, 0xFE, 0x3F, 0x8F, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x07, + 0xC7, 0xF1, 0xFC, 0x7F, 0x00, 0x03, 0xF8, 0xFE, 0x3F, 0x8F, 0xE0, 0x00, 0x03, 0xC0, 0x00, + 0x05, 0x4E, 0x3B, 0x8E, 0xE3, 0x80, 0x07, 0x1D, 0xC7, 0x71, 0xDC, 0x70, 0x00, 0x03, 0xC0, + 0x00, 0x01, 0x4E, 0x3A, 0x8E, 0xE3, 0x80, 0x05, 0x15, 0xC7, 0x51, 0x54, 0x50, 0x00, 0x03, + 0xC0, 0x00, 0x01, 0x4A, 0x2B, 0x8A, 0xA2, 0x80, 0x07, 0x15, 0x45, 0x71, 0x5C, 0x50, 0x00, + 0x03, 0xC0, 0x00, 0x01, 0x4A, 0x28, 0x0A, 0xA2, 0x80, 0x00, 0x15, 0x45, 0x01, 0x40, 0x50, + 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4A, 0x28, 0x0A, 0xA6, 0x80, 0x00, 0x15, 0x4D, 0x01, 0x40, + 0x50, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x4E, 0x28, 0x0E, 0xA6, 0x80, 0x00, 0x1D, 0x4D, 0x01, + 0xC0, 0x70, 0x00, 0x03, 0xC0, 0x00, 0x01, 0xC3, 0xE8, 0x0E, 0xAA, 0x9F, 0xE1, 0xF9, 0x55, + 0x1F, 0x87, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x01, 0xC3, 0xE8, 0x38, 0xAA, 0x90, 0x23, 0xF1, + 0x55, 0x3F, 0x0F, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x38, 0xB2, 0x9F, 0xE7, + 0x01, 0x65, 0x70, 0x1C, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, 0xB2, 0x80, + 0x05, 0x01, 0x65, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, 0xA2, + 0x80, 0x05, 0x01, 0x45, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x28, 0x28, + 0xA2, 0x80, 0x05, 0x01, 0x45, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, 0x38, + 0x28, 0xE3, 0x80, 0x05, 0x01, 0xC7, 0x50, 0x14, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x01, 0x40, + 0x38, 0x28, 0xE3, 0x80, 0x05, 0x0D, 0xC7, 0x50, 0xD4, 0x30, 0x00, 0x03, 0xD4, 0x00, 0x07, + 0xF3, 0xF0, 0x38, 0x7F, 0x00, 0x07, 0xFC, 0xFE, 0x7F, 0xDF, 0xF0, 0x00, 0x2B, 0xC8, 0x00, + 0x0F, 0xFB, 0xF0, 0x38, 0x7F, 0x00, 0x07, 0xFC, 0xFE, 0x7F, 0xDF, 0xF0, 0x00, 0x13, 0xD4, + 0x06, 0x0E, 0x00, 0x2B, 0xC0, 0x06, 0x0E, 0x00, 0x03, 0x06, 0x20, 0xFF}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_Cable.c b/applications/plugins/wii_ec_anal/gfx/img_cc_Cable.c index 2fc6b5f23..f4ac26173 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_Cable.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_Cable.c @@ -12,6 +12,14 @@ #include "images.h" -const image_t img_cc_Cable = { 4, 11, true, 4, 0x00, { // orig:6, comp:33.33% - 0x00, 0x05, 0xDB, 0xD0 -}}; +const image_t img_cc_Cable = { + 4, + 11, + true, + 4, + 0x00, + {// orig:6, comp:33.33% + 0x00, + 0x05, + 0xDB, + 0xD0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_Joy.c b/applications/plugins/wii_ec_anal/gfx/img_cc_Joy.c index dd189cb7e..5054103b3 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_Joy.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_Joy.c @@ -18,8 +18,8 @@ #include "images.h" -const image_t img_cc_Joy = { 17, 17, false, 37, 0, { - 0x00, 0x80, 0x01, 0xF0, 0x0F, 0xDF, 0x87, 0x01, 0xC3, 0x00, 0x61, 0x00, 0x11, 0x80, 0x0C, 0xC0, - 0x06, 0xC0, 0x01, 0xB0, 0x01, 0x98, 0x00, 0xC4, 0x00, 0x43, 0x00, 0x61, 0xC0, 0x70, 0xFD, 0xF8, - 0x07, 0xC0, 0x00, 0x80, 0x00 -}}; +const image_t img_cc_Joy = {17, 17, false, 37, 0, {0x00, 0x80, 0x01, 0xF0, 0x0F, 0xDF, 0x87, 0x01, + 0xC3, 0x00, 0x61, 0x00, 0x11, 0x80, 0x0C, 0xC0, + 0x06, 0xC0, 0x01, 0xB0, 0x01, 0x98, 0x00, 0xC4, + 0x00, 0x43, 0x00, 0x61, 0xC0, 0x70, 0xFD, 0xF8, + 0x07, 0xC0, 0x00, 0x80, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_Main.c b/applications/plugins/wii_ec_anal/gfx/img_cc_Main.c index 8e7bd5ed9..b29a9ab57 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_Main.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_Main.c @@ -54,39 +54,47 @@ #include "images.h" -const image_t img_cc_Main = { 116, 53, true, 542, 0x05, { // orig:769, comp:29.52% - 0x00, 0x00, 0x00, 0x7F, 0xC0, 0x05, 0x05, 0x00, 0x3F, 0xE0, 0x05, 0x04, 0x00, 0x01, 0xF8, 0x04, - 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x02, 0x01, 0xF8, 0x05, 0x04, 0x00, 0x60, 0x00, 0x41, 0x04, 0x00, - 0x60, 0x02, 0x08, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0xF0, 0x7F, 0xFF, 0xFF, - 0xE0, 0xFE, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x41, 0x04, 0x00, 0x60, 0x02, 0x08, - 0x20, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x50, 0x03, 0xFC, 0x10, 0x40, 0x06, 0x00, 0x20, 0x83, 0xFC, - 0x00, 0xA0, 0x00, 0x00, 0x09, 0x0F, 0xC0, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x3F, 0x09, - 0x00, 0x00, 0x01, 0x1F, 0x05, 0x09, 0x00, 0x0F, 0x88, 0x00, 0x00, 0x20, 0x05, 0x0A, 0xFF, 0xF0, - 0x40, 0x00, 0x04, 0x78, 0x05, 0x09, 0x00, 0x01, 0xE2, 0x00, 0x00, 0x9C, 0x05, 0x0A, 0x00, 0x03, - 0x90, 0x00, 0x13, 0x05, 0x0B, 0x00, 0x0C, 0x80, 0x03, 0xE0, 0x05, 0x0B, 0x00, 0x7C, 0x00, 0x38, - 0x05, 0x05, 0x00, 0xC6, 0xD8, 0x05, 0x04, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x1F, 0xF0, 0x00, 0x00, - 0x0D, 0x60, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x60, 0x01, 0xFF, 0x00, 0x00, 0x00, 0xD6, - 0xD8, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x60, 0x0C, 0x00, 0x18, 0x30, 0x00, 0x00, 0x0D, 0x6D, 0x80, - 0x00, 0x00, 0x31, 0x80, 0x03, 0x01, 0xC0, 0x01, 0x83, 0x00, 0x00, 0x00, 0x6C, 0xD8, 0x00, 0x00, - 0x06, 0x0C, 0x00, 0x38, 0x18, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, 0xCA, 0x60, 0x01, 0x81, 0x00, - 0x01, 0x93, 0x05, 0x07, 0x00, 0x0C, 0x46, 0x00, 0x0C, 0x30, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, - 0xCA, 0x60, 0x00, 0xC2, 0x00, 0xFF, 0x83, 0xFE, 0x05, 0x05, 0x00, 0x07, 0x06, 0x0C, 0x1C, 0x04, - 0x60, 0x0F, 0xF8, 0x3F, 0xE0, 0x05, 0x05, 0x00, 0xF8, 0x31, 0x83, 0xE0, 0x64, 0x00, 0xC0, 0x00, - 0x06, 0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x18, 0xC1, 0xF0, 0x63, 0x02, 0x40, 0x0C, 0x00, 0x00, 0x60, - 0x01, 0x99, 0x99, 0x98, 0x03, 0x06, 0x0E, 0x0C, 0x98, 0x2C, 0x00, 0xCE, 0x00, 0xE6, 0x00, 0x10, - 0x90, 0x90, 0x80, 0x65, 0x30, 0x01, 0x94, 0xC3, 0x80, 0x0C, 0x00, 0x00, 0x60, 0x01, 0x09, 0x09, - 0x08, 0x06, 0x73, 0x00, 0x19, 0xCC, 0x18, 0x00, 0xC0, 0x00, 0x06, 0x00, 0x19, 0x99, 0x99, 0x80, - 0x61, 0x30, 0x01, 0x94, 0xC1, 0x80, 0x0F, 0xF8, 0x3F, 0xE0, 0x00, 0xF0, 0xF0, 0xF0, 0x03, 0x26, - 0x0E, 0x0C, 0x18, 0x18, 0x00, 0xFF, 0x83, 0xFE, 0x05, 0x05, 0x00, 0x18, 0xC1, 0xF0, 0x63, 0x01, - 0x80, 0x00, 0x19, 0x30, 0x05, 0x06, 0x00, 0xF8, 0x31, 0x83, 0xE0, 0x18, 0x00, 0x01, 0x93, 0x05, - 0x06, 0x00, 0x07, 0x06, 0x8C, 0x1C, 0x01, 0x80, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, 0xC8, 0x60, - 0x00, 0x18, 0x00, 0x01, 0x83, 0x05, 0x07, 0x00, 0x0C, 0xC6, 0x00, 0x01, 0x80, 0x00, 0x18, 0x30, - 0x05, 0x07, 0x00, 0xCA, 0x60, 0x00, 0x1C, 0x00, 0x01, 0xFF, 0x05, 0x07, 0x00, 0x06, 0x6C, 0x00, - 0x03, 0x40, 0x00, 0x1F, 0xF0, 0x05, 0x07, 0x00, 0x31, 0x80, 0x00, 0x24, 0x05, 0x0A, 0x00, 0x01, - 0xF0, 0x00, 0x02, 0x60, 0x05, 0x0A, 0x00, 0x0E, 0x00, 0x00, 0x62, 0x05, 0x0D, 0x00, 0x04, 0x20, - 0x05, 0x0D, 0x00, 0x43, 0x05, 0x0D, 0x00, 0x0C, 0x10, 0x05, 0x0D, 0x00, 0x81, 0x80, 0x05, 0x0C, - 0x00, 0x18, 0x0C, 0x05, 0x0C, 0x00, 0x03, 0x00, 0x60, 0x05, 0x0C, 0x00, 0x60, 0x03, 0x05, 0x0C, - 0x00, 0x0C, 0x00, 0x18, 0x05, 0x0B, 0x00, 0x01, 0x80, 0x00, 0xE0, 0x05, 0x0B, 0x00, 0x70, 0x00, - 0x03, 0x05, 0x0B, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x05, 0x0A, 0x00, 0x03, 0x80, 0x00, 0x00, 0x78, - 0x05, 0x09, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x00, 0x05, 0x0A, 0xFF, 0xF0, 0x00, 0x00 -}}; +const image_t img_cc_Main = { + 116, + 53, + true, + 542, + 0x05, + {// orig:769, comp:29.52% + 0x00, 0x00, 0x00, 0x7F, 0xC0, 0x05, 0x05, 0x00, 0x3F, 0xE0, 0x05, 0x04, 0x00, 0x01, 0xF8, + 0x04, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x02, 0x01, 0xF8, 0x05, 0x04, 0x00, 0x60, 0x00, 0x41, + 0x04, 0x00, 0x60, 0x02, 0x08, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0xF0, + 0x7F, 0xFF, 0xFF, 0xE0, 0xFE, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x41, 0x04, + 0x00, 0x60, 0x02, 0x08, 0x20, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x50, 0x03, 0xFC, 0x10, 0x40, + 0x06, 0x00, 0x20, 0x83, 0xFC, 0x00, 0xA0, 0x00, 0x00, 0x09, 0x0F, 0xC0, 0x00, 0xF8, 0x00, + 0x00, 0x01, 0xF0, 0x00, 0x3F, 0x09, 0x00, 0x00, 0x01, 0x1F, 0x05, 0x09, 0x00, 0x0F, 0x88, + 0x00, 0x00, 0x20, 0x05, 0x0A, 0xFF, 0xF0, 0x40, 0x00, 0x04, 0x78, 0x05, 0x09, 0x00, 0x01, + 0xE2, 0x00, 0x00, 0x9C, 0x05, 0x0A, 0x00, 0x03, 0x90, 0x00, 0x13, 0x05, 0x0B, 0x00, 0x0C, + 0x80, 0x03, 0xE0, 0x05, 0x0B, 0x00, 0x7C, 0x00, 0x38, 0x05, 0x05, 0x00, 0xC6, 0xD8, 0x05, + 0x04, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x0D, 0x60, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x0E, 0x00, 0x60, 0x01, 0xFF, 0x00, 0x00, 0x00, 0xD6, 0xD8, 0x00, 0x00, 0x01, + 0xF0, 0x00, 0x60, 0x0C, 0x00, 0x18, 0x30, 0x00, 0x00, 0x0D, 0x6D, 0x80, 0x00, 0x00, 0x31, + 0x80, 0x03, 0x01, 0xC0, 0x01, 0x83, 0x00, 0x00, 0x00, 0x6C, 0xD8, 0x00, 0x00, 0x06, 0x0C, + 0x00, 0x38, 0x18, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, 0xCA, 0x60, 0x01, 0x81, 0x00, 0x01, + 0x93, 0x05, 0x07, 0x00, 0x0C, 0x46, 0x00, 0x0C, 0x30, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, + 0xCA, 0x60, 0x00, 0xC2, 0x00, 0xFF, 0x83, 0xFE, 0x05, 0x05, 0x00, 0x07, 0x06, 0x0C, 0x1C, + 0x04, 0x60, 0x0F, 0xF8, 0x3F, 0xE0, 0x05, 0x05, 0x00, 0xF8, 0x31, 0x83, 0xE0, 0x64, 0x00, + 0xC0, 0x00, 0x06, 0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x18, 0xC1, 0xF0, 0x63, 0x02, 0x40, 0x0C, + 0x00, 0x00, 0x60, 0x01, 0x99, 0x99, 0x98, 0x03, 0x06, 0x0E, 0x0C, 0x98, 0x2C, 0x00, 0xCE, + 0x00, 0xE6, 0x00, 0x10, 0x90, 0x90, 0x80, 0x65, 0x30, 0x01, 0x94, 0xC3, 0x80, 0x0C, 0x00, + 0x00, 0x60, 0x01, 0x09, 0x09, 0x08, 0x06, 0x73, 0x00, 0x19, 0xCC, 0x18, 0x00, 0xC0, 0x00, + 0x06, 0x00, 0x19, 0x99, 0x99, 0x80, 0x61, 0x30, 0x01, 0x94, 0xC1, 0x80, 0x0F, 0xF8, 0x3F, + 0xE0, 0x00, 0xF0, 0xF0, 0xF0, 0x03, 0x26, 0x0E, 0x0C, 0x18, 0x18, 0x00, 0xFF, 0x83, 0xFE, + 0x05, 0x05, 0x00, 0x18, 0xC1, 0xF0, 0x63, 0x01, 0x80, 0x00, 0x19, 0x30, 0x05, 0x06, 0x00, + 0xF8, 0x31, 0x83, 0xE0, 0x18, 0x00, 0x01, 0x93, 0x05, 0x06, 0x00, 0x07, 0x06, 0x8C, 0x1C, + 0x01, 0x80, 0x00, 0x19, 0x30, 0x05, 0x07, 0x00, 0xC8, 0x60, 0x00, 0x18, 0x00, 0x01, 0x83, + 0x05, 0x07, 0x00, 0x0C, 0xC6, 0x00, 0x01, 0x80, 0x00, 0x18, 0x30, 0x05, 0x07, 0x00, 0xCA, + 0x60, 0x00, 0x1C, 0x00, 0x01, 0xFF, 0x05, 0x07, 0x00, 0x06, 0x6C, 0x00, 0x03, 0x40, 0x00, + 0x1F, 0xF0, 0x05, 0x07, 0x00, 0x31, 0x80, 0x00, 0x24, 0x05, 0x0A, 0x00, 0x01, 0xF0, 0x00, + 0x02, 0x60, 0x05, 0x0A, 0x00, 0x0E, 0x00, 0x00, 0x62, 0x05, 0x0D, 0x00, 0x04, 0x20, 0x05, + 0x0D, 0x00, 0x43, 0x05, 0x0D, 0x00, 0x0C, 0x10, 0x05, 0x0D, 0x00, 0x81, 0x80, 0x05, 0x0C, + 0x00, 0x18, 0x0C, 0x05, 0x0C, 0x00, 0x03, 0x00, 0x60, 0x05, 0x0C, 0x00, 0x60, 0x03, 0x05, + 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x05, 0x0B, 0x00, 0x01, 0x80, 0x00, 0xE0, 0x05, 0x0B, 0x00, + 0x70, 0x00, 0x03, 0x05, 0x0B, 0x00, 0x0C, 0x00, 0x00, 0x1C, 0x05, 0x0A, 0x00, 0x03, 0x80, + 0x00, 0x00, 0x78, 0x05, 0x09, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x00, 0x05, 0x0A, 0xFF, 0xF0, + 0x00, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_A1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_A1.c index 4d54cbf22..0889b2a08 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_A1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_A1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_cc_btn_A1 = { 7, 7, false, 7, 0, { - 0xFF, 0xDF, 0x5E, 0x3D, 0x7F, 0xFF, 0x80 -}}; +const image_t img_cc_btn_A1 = {7, 7, false, 7, 0, {0xFF, 0xDF, 0x5E, 0x3D, 0x7F, 0xFF, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_B1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_B1.c index 89d357282..bbf5fba1a 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_B1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_B1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_cc_btn_B1 = { 7, 7, false, 7, 0, { - 0xFF, 0xBF, 0x7E, 0x7D, 0x7C, 0xFF, 0x80 -}}; +const image_t img_cc_btn_B1 = {7, 7, false, 7, 0, {0xFF, 0xBF, 0x7E, 0x7D, 0x7C, 0xFF, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_X1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_X1.c index a1e7f2876..2352ba695 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_X1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_X1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_cc_btn_X1 = { 7, 7, false, 7, 0, { - 0xFF, 0xFF, 0x5F, 0x7D, 0x7F, 0xFF, 0x80 -}}; +const image_t img_cc_btn_X1 = {7, 7, false, 7, 0, {0xFF, 0xFF, 0x5F, 0x7D, 0x7F, 0xFF, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_Y1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_Y1.c index 01f66b4c7..d7192e3e7 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_btn_Y1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_btn_Y1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_cc_btn_Y1 = { 7, 7, false, 7, 0, { - 0xFF, 0xFF, 0x5E, 0x3F, 0x7D, 0xFF, 0x80 -}}; +const image_t img_cc_btn_Y1 = {7, 7, false, 7, 0, {0xFF, 0xFF, 0x5E, 0x3F, 0x7D, 0xFF, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_pad_LR1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_pad_LR1.c index 698fcfdd6..300ed5eee 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_pad_LR1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_pad_LR1.c @@ -6,6 +6,4 @@ #include "images.h" -const image_t img_cc_pad_LR1 = { 7, 5, false, 5, 0, { - 0xFF, 0xFF, 0x1F, 0xFF, 0xE0 -}}; +const image_t img_cc_pad_LR1 = {7, 5, false, 5, 0, {0xFF, 0xFF, 0x1F, 0xFF, 0xE0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_pad_UD1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_pad_UD1.c index b7d104ee4..feb32d283 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_pad_UD1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_pad_UD1.c @@ -8,6 +8,4 @@ #include "images.h" -const image_t img_cc_pad_UD1 = { 5, 7, false, 5, 0, { - 0xFF, 0xF7, 0xBD, 0xFF, 0xE0 -}}; +const image_t img_cc_pad_UD1 = {5, 7, false, 5, 0, {0xFF, 0xF7, 0xBD, 0xFF, 0xE0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L1.c index cf4d7159b..c70e35334 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L1.c @@ -7,6 +7,10 @@ #include "images.h" -const image_t img_cc_trg_L1 = { 17, 6, false, 13, 0, { - 0x1F, 0xC9, 0x34, 0x92, 0x64, 0x92, 0x54, 0x92, 0x44, 0x93, 0xFC, 0xFE, 0x00 -}}; +const image_t img_cc_trg_L1 = { + 17, + 6, + false, + 13, + 0, + {0x1F, 0xC9, 0x34, 0x92, 0x64, 0x92, 0x54, 0x92, 0x44, 0x93, 0xFC, 0xFE, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L2.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L2.c index 9e61a64cc..47561ab98 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L2.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L2.c @@ -7,6 +7,22 @@ #include "images.h" -const image_t img_cc_trg_L2 = { 17, 6, true, 12, 0x01, { // orig:13, comp:7.69% - 0x1F, 0xD5, 0x35, 0x55, 0x75, 0x01, 0x04, 0x55, 0x57, 0xFD, 0x7E, 0x00 -}}; +const image_t img_cc_trg_L2 = { + 17, + 6, + true, + 12, + 0x01, + {// orig:13, comp:7.69% + 0x1F, + 0xD5, + 0x35, + 0x55, + 0x75, + 0x01, + 0x04, + 0x55, + 0x57, + 0xFD, + 0x7E, + 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L3.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L3.c index 1b06de5ee..0b51bed35 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L3.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L3.c @@ -7,6 +7,10 @@ #include "images.h" -const image_t img_cc_trg_L3 = { 17, 6, false, 13, 0, { - 0x1F, 0xB6, 0xBB, 0x6D, 0xBB, 0x6D, 0xBB, 0x6D, 0xBB, 0x6F, 0xFB, 0x7E, 0x00 -}}; +const image_t img_cc_trg_L3 = { + 17, + 6, + false, + 13, + 0, + {0x1F, 0xB6, 0xBB, 0x6D, 0xBB, 0x6D, 0xBB, 0x6D, 0xBB, 0x6F, 0xFB, 0x7E, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L4.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L4.c index 12f877ab1..062caca77 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L4.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_L4.c @@ -7,6 +7,18 @@ #include "images.h" -const image_t img_cc_trg_L4 = { 17, 6, true, 8, 0x01, { // orig:13, comp:38.46% - 0x1F, 0xFF, 0xBF, 0x01, 0x08, 0xFF, 0xFE, 0x00 -}}; +const image_t img_cc_trg_L4 = { + 17, + 6, + true, + 8, + 0x01, + {// orig:13, comp:38.46% + 0x1F, + 0xFF, + 0xBF, + 0x01, + 0x08, + 0xFF, + 0xFE, + 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R1.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R1.c index a196c0fe1..6f08886d3 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R1.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R1.c @@ -7,6 +7,10 @@ #include "images.h" -const image_t img_cc_trg_R1 = { 17, 6, false, 13, 0, { - 0x49, 0xFC, 0x49, 0x25, 0x92, 0x49, 0x24, 0x92, 0x5F, 0xE4, 0x90, 0x0F, 0xE4 -}}; +const image_t img_cc_trg_R1 = { + 17, + 6, + false, + 13, + 0, + {0x49, 0xFC, 0x49, 0x25, 0x92, 0x49, 0x24, 0x92, 0x5F, 0xE4, 0x90, 0x0F, 0xE4}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R2.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R2.c index ea5458f39..d85e45761 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R2.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R2.c @@ -7,6 +7,10 @@ #include "images.h" -const image_t img_cc_trg_R2 = { 17, 6, false, 13, 0, { - 0x55, 0xFC, 0x55, 0x55, 0x95, 0x55, 0x75, 0x55, 0x5F, 0xF5, 0x50, 0x0F, 0xD4 -}}; +const image_t img_cc_trg_R2 = { + 17, + 6, + false, + 13, + 0, + {0x55, 0xFC, 0x55, 0x55, 0x95, 0x55, 0x75, 0x55, 0x5F, 0xF5, 0x50, 0x0F, 0xD4}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R3.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R3.c index 94cf02bf0..082d160e2 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R3.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R3.c @@ -7,6 +7,10 @@ #include "images.h" -const image_t img_cc_trg_R3 = { 17, 6, false, 13, 0, { - 0xB6, 0xFC, 0x36, 0xDB, 0xAD, 0xB6, 0xFB, 0x6D, 0xBF, 0xFB, 0x68, 0x0F, 0xD8 -}}; +const image_t img_cc_trg_R3 = { + 17, + 6, + false, + 13, + 0, + {0xB6, 0xFC, 0x36, 0xDB, 0xAD, 0xB6, 0xFB, 0x6D, 0xBF, 0xFB, 0x68, 0x0F, 0xD8}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R4.c b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R4.c index c90fbe20b..0395058b8 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R4.c +++ b/applications/plugins/wii_ec_anal/gfx/img_cc_trg_R4.c @@ -7,6 +7,21 @@ #include "images.h" -const image_t img_cc_trg_R4 = { 17, 6, true, 11, 0x00, { // orig:13, comp:15.38% - 0xFF, 0xFC, 0x7F, 0xFF, 0xBF, 0x00, 0x05, 0xFF, 0xF8, 0x0F, 0xFC -}}; +const image_t img_cc_trg_R4 = { + 17, + 6, + true, + 11, + 0x00, + {// orig:13, comp:15.38% + 0xFF, + 0xFC, + 0x7F, + 0xFF, + 0xBF, + 0x00, + 0x05, + 0xFF, + 0xF8, + 0x0F, + 0xFC}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_csLogo_FULL.c b/applications/plugins/wii_ec_anal/gfx/img_csLogo_FULL.c index 97f09ac17..a8c030fa2 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_csLogo_FULL.c +++ b/applications/plugins/wii_ec_anal/gfx/img_csLogo_FULL.c @@ -41,41 +41,49 @@ #include "images.h" -const image_t img_csLogo_FULL = { 124, 40, true, 571, 0x0B, { // orig:620, comp:7.90% - 0x3F, 0xFF, 0xFE, 0x10, 0x43, 0xF8, 0x7F, 0x0F, 0xE1, 0xFC, 0x0B, 0x05, 0x00, 0x03, 0xFF, 0xFF, - 0xE3, 0x8E, 0x3F, 0x87, 0xF0, 0xFE, 0x1F, 0xC0, 0x0B, 0x05, 0x00, 0xFC, 0x00, 0x07, 0x38, 0xE6, - 0x1C, 0xE3, 0x80, 0x73, 0x8E, 0x03, 0xBB, 0x80, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x52, 0x8A, 0x71, - 0xCE, 0x39, 0xC7, 0x38, 0xA0, 0x22, 0x10, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x05, 0x28, 0xA7, 0x14, - 0xA2, 0x9C, 0x52, 0x8A, 0x03, 0x39, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x52, 0x8A, 0x51, 0x4A, - 0x29, 0x45, 0x28, 0xA0, 0x20, 0x90, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x07, 0x28, 0xA5, 0x14, 0xA2, - 0x94, 0x52, 0x8E, 0x03, 0xB9, 0x40, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x02, 0x8A, 0x51, 0xCA, 0xA9, - 0x47, 0x28, 0x0B, 0x06, 0x00, 0xCC, 0x00, 0x00, 0x38, 0xE5, 0xF0, 0xA2, 0x97, 0xC2, 0x80, 0x06, - 0xEE, 0x80, 0x00, 0x00, 0x0E, 0xC3, 0x00, 0x01, 0xFC, 0x5F, 0x0A, 0x29, 0x7C, 0x2B, 0xC0, 0x2A, - 0xAA, 0x00, 0x00, 0x00, 0xDC, 0x30, 0x00, 0x0D, 0x85, 0x1C, 0xAA, 0x94, 0xE2, 0xBE, 0x02, 0xEE, - 0xE0, 0x00, 0x00, 0x0E, 0xC0, 0x30, 0x00, 0x50, 0x51, 0x4A, 0x29, 0x4A, 0x28, 0xA0, 0x22, 0xA2, - 0x00, 0x00, 0x00, 0xDC, 0x04, 0x80, 0x05, 0x05, 0x14, 0xA2, 0x94, 0xA2, 0x8A, 0x07, 0x2E, 0x20, - 0x00, 0x08, 0x0E, 0xC0, 0x48, 0x00, 0x50, 0x51, 0x4A, 0x29, 0x4A, 0x38, 0xA0, 0x00, 0x00, 0x00, - 0x01, 0x40, 0xDC, 0x03, 0x00, 0x05, 0x07, 0x1C, 0xE3, 0x94, 0xA3, 0x8A, 0x0B, 0x04, 0x00, 0xE2, - 0x0C, 0xC0, 0x00, 0x00, 0x70, 0x71, 0xCE, 0x39, 0x4A, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x0C, 0x90, - 0xCC, 0x00, 0x00, 0x07, 0x03, 0xF8, 0x7F, 0x1C, 0xE1, 0xFC, 0x0B, 0x04, 0x00, 0x94, 0x8C, 0xC0, - 0x00, 0x00, 0xF8, 0x3F, 0x87, 0xF1, 0xC7, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x72, 0x24, 0xCC, 0x0B, - 0x0C, 0x00, 0x06, 0x15, 0x2C, 0xC0, 0x0B, 0x0C, 0x00, 0x48, 0x89, 0xCC, 0x00, 0xFE, 0x10, 0x43, - 0xF8, 0xFF, 0x8F, 0xE1, 0xFC, 0x3F, 0x80, 0x00, 0x39, 0x05, 0x3C, 0xC0, 0x0F, 0xE3, 0x8E, 0x3F, - 0x8F, 0xF8, 0xFE, 0x1F, 0xC3, 0xF8, 0x00, 0x03, 0x22, 0x27, 0xDC, 0x01, 0x87, 0x38, 0xE6, 0x1C, - 0xDD, 0x99, 0xF3, 0xFE, 0x61, 0xC0, 0x00, 0x21, 0x50, 0xFE, 0xC0, 0x1C, 0x52, 0x8A, 0x71, 0x41, - 0x41, 0xC0, 0x3A, 0xE7, 0x14, 0x00, 0x1C, 0x88, 0x9E, 0xDC, 0x01, 0x45, 0x28, 0xA5, 0x14, 0x14, - 0x14, 0x02, 0xAA, 0x51, 0x40, 0x01, 0x94, 0x13, 0xEE, 0xC0, 0x14, 0x52, 0x8A, 0x51, 0x41, 0x41, - 0x40, 0x2A, 0xA5, 0x14, 0x00, 0x12, 0x22, 0x7F, 0xDC, 0x01, 0x47, 0x28, 0xA5, 0x1C, 0x14, 0x14, - 0x02, 0xAA, 0x51, 0xC0, 0x0E, 0x05, 0x0F, 0x3E, 0xC0, 0x1C, 0x02, 0x8A, 0x70, 0x01, 0x41, 0x4E, - 0x2A, 0xA7, 0x00, 0x00, 0xC0, 0x09, 0xF0, 0xCC, 0x00, 0xFC, 0x38, 0xE3, 0xF0, 0x14, 0x17, 0x82, - 0xAA, 0x3F, 0x00, 0x09, 0x01, 0x3F, 0x8F, 0xC0, 0x03, 0xE1, 0xFC, 0x0F, 0x81, 0x41, 0x78, 0x2A, - 0xA0, 0xF8, 0x01, 0x28, 0x27, 0x98, 0xFC, 0x00, 0x07, 0x0D, 0x80, 0x1C, 0x14, 0x14, 0xE2, 0xAA, - 0x01, 0xC0, 0x28, 0x40, 0xF8, 0x0C, 0xC0, 0x1C, 0x50, 0x50, 0x71, 0x41, 0x41, 0x40, 0x28, 0xA7, - 0x14, 0x03, 0x02, 0x9F, 0xC0, 0xFC, 0x01, 0x45, 0x05, 0x05, 0x14, 0x14, 0x14, 0x02, 0xAA, 0x51, - 0x40, 0x32, 0x13, 0xCC, 0x0F, 0xC1, 0x94, 0x50, 0x50, 0x51, 0x41, 0x41, 0x40, 0x28, 0xA5, 0x14, - 0x01, 0xF2, 0x7C, 0x00, 0xFC, 0x19, 0x47, 0x05, 0x05, 0x1C, 0x14, 0x1C, 0x02, 0x8A, 0x51, 0xC0, - 0x0E, 0x0F, 0xE0, 0x0F, 0xC1, 0x9C, 0x30, 0x70, 0x70, 0xC1, 0x41, 0x9F, 0x28, 0xA7, 0x0C, 0x00, - 0x61, 0xE6, 0x00, 0x3F, 0xF8, 0xFE, 0x07, 0x03, 0xF8, 0x1C, 0x0F, 0xE3, 0x8E, 0x3F, 0x80, 0x03, - 0xBE, 0x00, 0x03, 0xFF, 0x8F, 0xE0, 0xF8, 0x3F, 0x81, 0xC0, 0xFE, 0x38, 0xE3, 0xF8, 0x00, 0x1F, - 0xF0, 0x0B, 0x0E, 0x00, 0xF3, 0x0B, 0x0E, 0x00, 0x06, 0x00, 0x00 -}}; +const image_t img_csLogo_FULL = { + 124, + 40, + true, + 571, + 0x0B, + {// orig:620, comp:7.90% + 0x3F, 0xFF, 0xFE, 0x10, 0x43, 0xF8, 0x7F, 0x0F, 0xE1, 0xFC, 0x0B, 0x05, 0x00, 0x03, 0xFF, + 0xFF, 0xE3, 0x8E, 0x3F, 0x87, 0xF0, 0xFE, 0x1F, 0xC0, 0x0B, 0x05, 0x00, 0xFC, 0x00, 0x07, + 0x38, 0xE6, 0x1C, 0xE3, 0x80, 0x73, 0x8E, 0x03, 0xBB, 0x80, 0x00, 0x00, 0x0F, 0xC0, 0x00, + 0x52, 0x8A, 0x71, 0xCE, 0x39, 0xC7, 0x38, 0xA0, 0x22, 0x10, 0x00, 0x00, 0x00, 0xFC, 0x00, + 0x05, 0x28, 0xA7, 0x14, 0xA2, 0x9C, 0x52, 0x8A, 0x03, 0x39, 0x00, 0x00, 0x00, 0x0C, 0xC0, + 0x00, 0x52, 0x8A, 0x51, 0x4A, 0x29, 0x45, 0x28, 0xA0, 0x20, 0x90, 0x00, 0x00, 0x00, 0xFC, + 0x00, 0x07, 0x28, 0xA5, 0x14, 0xA2, 0x94, 0x52, 0x8E, 0x03, 0xB9, 0x40, 0x00, 0x00, 0x0F, + 0xC0, 0x00, 0x02, 0x8A, 0x51, 0xCA, 0xA9, 0x47, 0x28, 0x0B, 0x06, 0x00, 0xCC, 0x00, 0x00, + 0x38, 0xE5, 0xF0, 0xA2, 0x97, 0xC2, 0x80, 0x06, 0xEE, 0x80, 0x00, 0x00, 0x0E, 0xC3, 0x00, + 0x01, 0xFC, 0x5F, 0x0A, 0x29, 0x7C, 0x2B, 0xC0, 0x2A, 0xAA, 0x00, 0x00, 0x00, 0xDC, 0x30, + 0x00, 0x0D, 0x85, 0x1C, 0xAA, 0x94, 0xE2, 0xBE, 0x02, 0xEE, 0xE0, 0x00, 0x00, 0x0E, 0xC0, + 0x30, 0x00, 0x50, 0x51, 0x4A, 0x29, 0x4A, 0x28, 0xA0, 0x22, 0xA2, 0x00, 0x00, 0x00, 0xDC, + 0x04, 0x80, 0x05, 0x05, 0x14, 0xA2, 0x94, 0xA2, 0x8A, 0x07, 0x2E, 0x20, 0x00, 0x08, 0x0E, + 0xC0, 0x48, 0x00, 0x50, 0x51, 0x4A, 0x29, 0x4A, 0x38, 0xA0, 0x00, 0x00, 0x00, 0x01, 0x40, + 0xDC, 0x03, 0x00, 0x05, 0x07, 0x1C, 0xE3, 0x94, 0xA3, 0x8A, 0x0B, 0x04, 0x00, 0xE2, 0x0C, + 0xC0, 0x00, 0x00, 0x70, 0x71, 0xCE, 0x39, 0x4A, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x0C, 0x90, + 0xCC, 0x00, 0x00, 0x07, 0x03, 0xF8, 0x7F, 0x1C, 0xE1, 0xFC, 0x0B, 0x04, 0x00, 0x94, 0x8C, + 0xC0, 0x00, 0x00, 0xF8, 0x3F, 0x87, 0xF1, 0xC7, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x72, 0x24, + 0xCC, 0x0B, 0x0C, 0x00, 0x06, 0x15, 0x2C, 0xC0, 0x0B, 0x0C, 0x00, 0x48, 0x89, 0xCC, 0x00, + 0xFE, 0x10, 0x43, 0xF8, 0xFF, 0x8F, 0xE1, 0xFC, 0x3F, 0x80, 0x00, 0x39, 0x05, 0x3C, 0xC0, + 0x0F, 0xE3, 0x8E, 0x3F, 0x8F, 0xF8, 0xFE, 0x1F, 0xC3, 0xF8, 0x00, 0x03, 0x22, 0x27, 0xDC, + 0x01, 0x87, 0x38, 0xE6, 0x1C, 0xDD, 0x99, 0xF3, 0xFE, 0x61, 0xC0, 0x00, 0x21, 0x50, 0xFE, + 0xC0, 0x1C, 0x52, 0x8A, 0x71, 0x41, 0x41, 0xC0, 0x3A, 0xE7, 0x14, 0x00, 0x1C, 0x88, 0x9E, + 0xDC, 0x01, 0x45, 0x28, 0xA5, 0x14, 0x14, 0x14, 0x02, 0xAA, 0x51, 0x40, 0x01, 0x94, 0x13, + 0xEE, 0xC0, 0x14, 0x52, 0x8A, 0x51, 0x41, 0x41, 0x40, 0x2A, 0xA5, 0x14, 0x00, 0x12, 0x22, + 0x7F, 0xDC, 0x01, 0x47, 0x28, 0xA5, 0x1C, 0x14, 0x14, 0x02, 0xAA, 0x51, 0xC0, 0x0E, 0x05, + 0x0F, 0x3E, 0xC0, 0x1C, 0x02, 0x8A, 0x70, 0x01, 0x41, 0x4E, 0x2A, 0xA7, 0x00, 0x00, 0xC0, + 0x09, 0xF0, 0xCC, 0x00, 0xFC, 0x38, 0xE3, 0xF0, 0x14, 0x17, 0x82, 0xAA, 0x3F, 0x00, 0x09, + 0x01, 0x3F, 0x8F, 0xC0, 0x03, 0xE1, 0xFC, 0x0F, 0x81, 0x41, 0x78, 0x2A, 0xA0, 0xF8, 0x01, + 0x28, 0x27, 0x98, 0xFC, 0x00, 0x07, 0x0D, 0x80, 0x1C, 0x14, 0x14, 0xE2, 0xAA, 0x01, 0xC0, + 0x28, 0x40, 0xF8, 0x0C, 0xC0, 0x1C, 0x50, 0x50, 0x71, 0x41, 0x41, 0x40, 0x28, 0xA7, 0x14, + 0x03, 0x02, 0x9F, 0xC0, 0xFC, 0x01, 0x45, 0x05, 0x05, 0x14, 0x14, 0x14, 0x02, 0xAA, 0x51, + 0x40, 0x32, 0x13, 0xCC, 0x0F, 0xC1, 0x94, 0x50, 0x50, 0x51, 0x41, 0x41, 0x40, 0x28, 0xA5, + 0x14, 0x01, 0xF2, 0x7C, 0x00, 0xFC, 0x19, 0x47, 0x05, 0x05, 0x1C, 0x14, 0x1C, 0x02, 0x8A, + 0x51, 0xC0, 0x0E, 0x0F, 0xE0, 0x0F, 0xC1, 0x9C, 0x30, 0x70, 0x70, 0xC1, 0x41, 0x9F, 0x28, + 0xA7, 0x0C, 0x00, 0x61, 0xE6, 0x00, 0x3F, 0xF8, 0xFE, 0x07, 0x03, 0xF8, 0x1C, 0x0F, 0xE3, + 0x8E, 0x3F, 0x80, 0x03, 0xBE, 0x00, 0x03, 0xFF, 0x8F, 0xE0, 0xF8, 0x3F, 0x81, 0xC0, 0xFE, + 0x38, 0xE3, 0xF8, 0x00, 0x1F, 0xF0, 0x0B, 0x0E, 0x00, 0xF3, 0x0B, 0x0E, 0x00, 0x06, 0x00, + 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_csLogo_Small.c b/applications/plugins/wii_ec_anal/gfx/img_csLogo_Small.c index 5cd2f613f..71debc2ff 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_csLogo_Small.c +++ b/applications/plugins/wii_ec_anal/gfx/img_csLogo_Small.c @@ -13,6 +13,10 @@ #include "images.h" -const image_t img_csLogo_Small = { 9, 12, false, 14, 0, { - 0xFF, 0xFF, 0xF0, 0x78, 0x3D, 0x06, 0x3F, 0x13, 0x88, 0xC7, 0xE0, 0x7D, 0x3E, 0xF0 -}}; +const image_t img_csLogo_Small = { + 9, + 12, + false, + 14, + 0, + {0xFF, 0xFF, 0xF0, 0x78, 0x3D, 0x06, 0x3F, 0x13, 0x88, 0xC7, 0xE0, 0x7D, 0x3E, 0xF0}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_ecp_SCL.c b/applications/plugins/wii_ec_anal/gfx/img_ecp_SCL.c index 533b79c7b..e3622a626 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_ecp_SCL.c +++ b/applications/plugins/wii_ec_anal/gfx/img_ecp_SCL.c @@ -8,6 +8,10 @@ #include "images.h" -const image_t img_ecp_SCL = { 16, 7, false, 14, 0, { - 0x3F, 0x8F, 0x3F, 0x8F, 0x31, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0xF1, 0xFC, 0xF1, 0xFC -}}; +const image_t img_ecp_SCL = { + 16, + 7, + false, + 14, + 0, + {0x3F, 0x8F, 0x3F, 0x8F, 0x31, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0xF1, 0xFC, 0xF1, 0xFC}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_ecp_SDA.c b/applications/plugins/wii_ec_anal/gfx/img_ecp_SDA.c index 7384fc87c..5ce0cbec4 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_ecp_SDA.c +++ b/applications/plugins/wii_ec_anal/gfx/img_ecp_SDA.c @@ -13,7 +13,7 @@ #include "images.h" -const image_t img_ecp_SDA = { 17, 12, false, 26, 0, { - 0x10, 0x00, 0x18, 0x00, 0x18, 0x00, 0x1F, 0xFC, 0x0F, 0xFE, 0x43, 0x00, 0x30, 0xC0, 0x0C, 0x27, - 0xFF, 0x03, 0xFF, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x80 -}}; +const image_t img_ecp_SDA = {17, 12, false, 26, 0, {0x10, 0x00, 0x18, 0x00, 0x18, 0x00, 0x1F, + 0xFC, 0x0F, 0xFE, 0x43, 0x00, 0x30, 0xC0, + 0x0C, 0x27, 0xFF, 0x03, 0xFF, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x00, 0x80}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_ecp_port.c b/applications/plugins/wii_ec_anal/gfx/img_ecp_port.c index 942f0c593..60f535458 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_ecp_port.c +++ b/applications/plugins/wii_ec_anal/gfx/img_ecp_port.c @@ -43,24 +43,30 @@ #include "images.h" -const image_t img_ecp_port = { 69, 42, true, 290, 0x04, { // orig:363, comp:20.11% - 0x00, 0x2A, 0x04, 0x06, 0xAA, 0xA8, 0x02, 0x04, 0x07, 0xAA, 0x80, 0x2A, 0x04, 0x07, 0xAA, 0x02, - 0x04, 0x07, 0xAA, 0xA0, 0x2A, 0x04, 0x07, 0xAA, 0x82, 0x04, 0x07, 0xAA, 0xA8, 0x2A, 0x04, 0x07, - 0xAA, 0xA3, 0x04, 0x07, 0xFF, 0xAA, 0x1F, 0x04, 0x06, 0xFF, 0xFE, 0xA8, 0xC0, 0x04, 0x06, 0x00, - 0x6A, 0x86, 0x04, 0x06, 0x00, 0x03, 0xAA, 0x30, 0x04, 0x06, 0x00, 0x1A, 0xA1, 0x80, 0x04, 0x06, - 0x00, 0xEA, 0x8C, 0x04, 0x06, 0x00, 0x06, 0xA8, 0x61, 0x04, 0x05, 0xFF, 0xFC, 0x3A, 0xA3, 0x0F, - 0x04, 0x05, 0xFF, 0xE1, 0xAA, 0x18, 0x61, 0x83, 0x0C, 0x18, 0x60, 0xC3, 0x0E, 0xA8, 0xC3, 0x0C, - 0x18, 0x60, 0xC3, 0x06, 0x18, 0x6A, 0x86, 0x18, 0x7F, 0xC3, 0xFE, 0x1F, 0xF0, 0xC3, 0xAA, 0x30, - 0xC3, 0xFE, 0x1F, 0xF0, 0xFF, 0x86, 0x1A, 0xA1, 0x86, 0x04, 0x05, 0x00, 0x30, 0xEA, 0xBC, 0x30, - 0x04, 0x04, 0x00, 0x01, 0x86, 0xFB, 0xE1, 0x80, 0x04, 0x04, 0x00, 0x0C, 0x3F, 0xFF, 0x0C, 0x04, - 0x05, 0x00, 0x61, 0xBE, 0x78, 0x60, 0x04, 0x04, 0x00, 0x03, 0x0F, 0xF8, 0xC3, 0x0F, 0xF8, 0x00, - 0x03, 0xFE, 0x18, 0x6A, 0x86, 0x18, 0x7F, 0xC0, 0x00, 0x1F, 0xF0, 0xC3, 0xAA, 0x30, 0xC3, 0x06, - 0x1F, 0xF0, 0xC1, 0x86, 0x1A, 0xA1, 0x86, 0x18, 0x30, 0x80, 0x86, 0x0C, 0x30, 0xEA, 0x8C, 0x3F, - 0x04, 0x05, 0xFF, 0x86, 0xA8, 0x61, 0x04, 0x05, 0xFF, 0xFC, 0x3A, 0xA3, 0x04, 0x06, 0x00, 0x01, - 0xAA, 0x18, 0x04, 0x06, 0x00, 0x0E, 0xA8, 0xC0, 0x04, 0x06, 0x00, 0x6A, 0x86, 0x00, 0x00, 0x7F, - 0xFF, 0xF0, 0x00, 0x03, 0xAA, 0x30, 0x00, 0x03, 0xFF, 0xFF, 0x80, 0x00, 0x1A, 0xA1, 0x80, 0x00, - 0x1A, 0xA0, 0x0C, 0x00, 0x00, 0xEA, 0x0C, 0x00, 0x00, 0xEA, 0x00, 0x60, 0x00, 0x06, 0xA0, 0x60, - 0x00, 0x06, 0xA0, 0x03, 0x00, 0x00, 0x3A, 0x03, 0x00, 0x00, 0x3A, 0x00, 0x18, 0x00, 0x01, 0xA0, - 0x1F, 0xFF, 0xFF, 0xA0, 0x00, 0xFF, 0xFF, 0xFE, 0x00, 0xFF, 0xFF, 0xFE, 0x00, 0x07, 0xFF, 0xFF, - 0xE0, 0x00 -}}; +const image_t img_ecp_port = { + 69, + 42, + true, + 290, + 0x04, + {// orig:363, comp:20.11% + 0x00, 0x2A, 0x04, 0x06, 0xAA, 0xA8, 0x02, 0x04, 0x07, 0xAA, 0x80, 0x2A, 0x04, 0x07, 0xAA, + 0x02, 0x04, 0x07, 0xAA, 0xA0, 0x2A, 0x04, 0x07, 0xAA, 0x82, 0x04, 0x07, 0xAA, 0xA8, 0x2A, + 0x04, 0x07, 0xAA, 0xA3, 0x04, 0x07, 0xFF, 0xAA, 0x1F, 0x04, 0x06, 0xFF, 0xFE, 0xA8, 0xC0, + 0x04, 0x06, 0x00, 0x6A, 0x86, 0x04, 0x06, 0x00, 0x03, 0xAA, 0x30, 0x04, 0x06, 0x00, 0x1A, + 0xA1, 0x80, 0x04, 0x06, 0x00, 0xEA, 0x8C, 0x04, 0x06, 0x00, 0x06, 0xA8, 0x61, 0x04, 0x05, + 0xFF, 0xFC, 0x3A, 0xA3, 0x0F, 0x04, 0x05, 0xFF, 0xE1, 0xAA, 0x18, 0x61, 0x83, 0x0C, 0x18, + 0x60, 0xC3, 0x0E, 0xA8, 0xC3, 0x0C, 0x18, 0x60, 0xC3, 0x06, 0x18, 0x6A, 0x86, 0x18, 0x7F, + 0xC3, 0xFE, 0x1F, 0xF0, 0xC3, 0xAA, 0x30, 0xC3, 0xFE, 0x1F, 0xF0, 0xFF, 0x86, 0x1A, 0xA1, + 0x86, 0x04, 0x05, 0x00, 0x30, 0xEA, 0xBC, 0x30, 0x04, 0x04, 0x00, 0x01, 0x86, 0xFB, 0xE1, + 0x80, 0x04, 0x04, 0x00, 0x0C, 0x3F, 0xFF, 0x0C, 0x04, 0x05, 0x00, 0x61, 0xBE, 0x78, 0x60, + 0x04, 0x04, 0x00, 0x03, 0x0F, 0xF8, 0xC3, 0x0F, 0xF8, 0x00, 0x03, 0xFE, 0x18, 0x6A, 0x86, + 0x18, 0x7F, 0xC0, 0x00, 0x1F, 0xF0, 0xC3, 0xAA, 0x30, 0xC3, 0x06, 0x1F, 0xF0, 0xC1, 0x86, + 0x1A, 0xA1, 0x86, 0x18, 0x30, 0x80, 0x86, 0x0C, 0x30, 0xEA, 0x8C, 0x3F, 0x04, 0x05, 0xFF, + 0x86, 0xA8, 0x61, 0x04, 0x05, 0xFF, 0xFC, 0x3A, 0xA3, 0x04, 0x06, 0x00, 0x01, 0xAA, 0x18, + 0x04, 0x06, 0x00, 0x0E, 0xA8, 0xC0, 0x04, 0x06, 0x00, 0x6A, 0x86, 0x00, 0x00, 0x7F, 0xFF, + 0xF0, 0x00, 0x03, 0xAA, 0x30, 0x00, 0x03, 0xFF, 0xFF, 0x80, 0x00, 0x1A, 0xA1, 0x80, 0x00, + 0x1A, 0xA0, 0x0C, 0x00, 0x00, 0xEA, 0x0C, 0x00, 0x00, 0xEA, 0x00, 0x60, 0x00, 0x06, 0xA0, + 0x60, 0x00, 0x06, 0xA0, 0x03, 0x00, 0x00, 0x3A, 0x03, 0x00, 0x00, 0x3A, 0x00, 0x18, 0x00, + 0x01, 0xA0, 0x1F, 0xFF, 0xFF, 0xA0, 0x00, 0xFF, 0xFF, 0xFE, 0x00, 0xFF, 0xFF, 0xFE, 0x00, + 0x07, 0xFF, 0xFF, 0xE0, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_Back.c b/applications/plugins/wii_ec_anal/gfx/img_key_Back.c index d13bcf7f2..23c17fe2b 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_Back.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_Back.c @@ -10,6 +10,5 @@ #include "images.h" -const image_t img_key_Back = { 9, 9, false, 11, 0, { - 0x7F, 0x7F, 0xFB, 0xF8, 0x7E, 0xDF, 0xEF, 0xCF, 0xFF, 0x3F, 0x00 -}}; +const image_t img_key_Back = + {9, 9, false, 11, 0, {0x7F, 0x7F, 0xFB, 0xF8, 0x7E, 0xDF, 0xEF, 0xCF, 0xFF, 0x3F, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_D.c b/applications/plugins/wii_ec_anal/gfx/img_key_D.c index 8d182427c..689b9148c 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_D.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_D.c @@ -9,6 +9,5 @@ #include "images.h" -const image_t img_key_D = { 9, 8, false, 9, 0, { - 0x7F, 0x7F, 0xFF, 0xF8, 0x3E, 0x3F, 0xBF, 0xFE, 0xFE -}}; +const image_t img_key_D = + {9, 8, false, 9, 0, {0x7F, 0x7F, 0xFF, 0xF8, 0x3E, 0x3F, 0xBF, 0xFE, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_L.c b/applications/plugins/wii_ec_anal/gfx/img_key_L.c index 1fc5556b1..a5fca1a21 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_L.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_L.c @@ -10,6 +10,5 @@ #include "images.h" -const image_t img_key_L = { 8, 9, false, 9, 0, { - 0x7E, 0xFF, 0xF7, 0xE7, 0xC7, 0xE7, 0xF7, 0xFF, 0x7E -}}; +const image_t img_key_L = + {8, 9, false, 9, 0, {0x7E, 0xFF, 0xF7, 0xE7, 0xC7, 0xE7, 0xF7, 0xFF, 0x7E}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_OK.c b/applications/plugins/wii_ec_anal/gfx/img_key_OK.c index ef64128f8..926d91c2e 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_OK.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_OK.c @@ -10,6 +10,5 @@ #include "images.h" -const image_t img_key_OK = { 9, 9, false, 11, 0, { - 0x7F, 0x7F, 0xF8, 0xF8, 0x3C, 0x1E, 0x0F, 0x8F, 0xFF, 0x3F, 0x00 -}}; +const image_t img_key_OK = + {9, 9, false, 11, 0, {0x7F, 0x7F, 0xF8, 0xF8, 0x3C, 0x1E, 0x0F, 0x8F, 0xFF, 0x3F, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_OKi.c b/applications/plugins/wii_ec_anal/gfx/img_key_OKi.c index 595f2f431..aa6f9e692 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_OKi.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_OKi.c @@ -10,6 +10,5 @@ #include "images.h" -const image_t img_key_OKi = { 9, 9, false, 11, 0, { - 0x7F, 0x60, 0xE7, 0x37, 0xDB, 0xED, 0xF6, 0x73, 0x83, 0x7F, 0x00 -}}; +const image_t img_key_OKi = + {9, 9, false, 11, 0, {0x7F, 0x60, 0xE7, 0x37, 0xDB, 0xED, 0xF6, 0x73, 0x83, 0x7F, 0x00}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_R.c b/applications/plugins/wii_ec_anal/gfx/img_key_R.c index 87cc385bc..8b97c7b48 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_R.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_R.c @@ -10,6 +10,5 @@ #include "images.h" -const image_t img_key_R = { 8, 9, false, 9, 0, { - 0x7E, 0xFF, 0xEF, 0xE7, 0xE3, 0xE7, 0xEF, 0xFF, 0x7E -}}; +const image_t img_key_R = + {8, 9, false, 9, 0, {0x7E, 0xFF, 0xEF, 0xE7, 0xE3, 0xE7, 0xEF, 0xFF, 0x7E}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_U.c b/applications/plugins/wii_ec_anal/gfx/img_key_U.c index aca5bb62a..65f4cd9e0 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_U.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_U.c @@ -9,6 +9,5 @@ #include "images.h" -const image_t img_key_U = { 9, 8, false, 9, 0, { - 0x7F, 0x7F, 0xFD, 0xFC, 0x7C, 0x1F, 0xFF, 0xFE, 0xFE -}}; +const image_t img_key_U = + {9, 8, false, 9, 0, {0x7F, 0x7F, 0xFD, 0xFC, 0x7C, 0x1F, 0xFF, 0xFE, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/gfx/img_key_Ui.c b/applications/plugins/wii_ec_anal/gfx/img_key_Ui.c index b740780ad..30c60c66e 100644 --- a/applications/plugins/wii_ec_anal/gfx/img_key_Ui.c +++ b/applications/plugins/wii_ec_anal/gfx/img_key_Ui.c @@ -9,6 +9,5 @@ #include "images.h" -const image_t img_key_Ui = { 9, 8, false, 9, 0, { - 0x7F, 0x60, 0xE2, 0x33, 0x9B, 0xEC, 0x07, 0x06, 0xFE -}}; +const image_t img_key_Ui = + {9, 8, false, 9, 0, {0x7F, 0x60, 0xE2, 0x33, 0x9B, 0xEC, 0x07, 0x06, 0xFE}}; diff --git a/applications/plugins/wii_ec_anal/i2c_workaround.h b/applications/plugins/wii_ec_anal/i2c_workaround.h index de1dbba54..b24efaf48 100644 --- a/applications/plugins/wii_ec_anal/i2c_workaround.h +++ b/applications/plugins/wii_ec_anal/i2c_workaround.h @@ -40,62 +40,70 @@ void furi_hal_i2c_release (FuriHalI2cBusHandle* handle) */ -#ifndef I2C_WORKAROUND_H_ -#define I2C_WORKAROUND_H_ +#ifndef I2C_WORKAROUND_H_ +#define I2C_WORKAROUND_H_ -#include +#include #define ENABLE_WORKAROUND 1 #if ENABLE_WORKAROUND == 1 - //+============================================================================ ======================================== - static inline - bool furi_hal_Wi2c_is_device_ready (FuriHalI2cBusHandle* const bus, const uint8_t addr, const uint32_t tmo) - { - furi_hal_i2c_acquire(bus); - bool rv = furi_hal_i2c_is_device_ready(bus, addr, tmo); - furi_hal_i2c_release(bus); - return rv; - } +//+============================================================================ ======================================== +static inline bool furi_hal_Wi2c_is_device_ready( + FuriHalI2cBusHandle* const bus, + const uint8_t addr, + const uint32_t tmo) { + furi_hal_i2c_acquire(bus); + bool rv = furi_hal_i2c_is_device_ready(bus, addr, tmo); + furi_hal_i2c_release(bus); + return rv; +} - //+============================================================================ - static inline - bool furi_hal_Wi2c_tx ( FuriHalI2cBusHandle* const bus, const uint8_t addr, - const void* buf, const size_t len, const uint32_t tmo ) - { - furi_hal_i2c_acquire(bus); - bool rv = furi_hal_i2c_tx(bus, addr, buf, len, tmo); - furi_hal_i2c_release(bus); - return rv; - } +//+============================================================================ +static inline bool furi_hal_Wi2c_tx( + FuriHalI2cBusHandle* const bus, + const uint8_t addr, + const void* buf, + const size_t len, + const uint32_t tmo) { + furi_hal_i2c_acquire(bus); + bool rv = furi_hal_i2c_tx(bus, addr, buf, len, tmo); + furi_hal_i2c_release(bus); + return rv; +} - //+============================================================================ - static inline - bool furi_hal_Wi2c_rx ( FuriHalI2cBusHandle* const bus, const uint8_t addr, - void* buf, const size_t len, const uint32_t tmo ) - { - furi_hal_i2c_acquire(bus); - bool rv = furi_hal_i2c_rx(bus, addr, buf, len, tmo); - furi_hal_i2c_release(bus); - return rv; - } +//+============================================================================ +static inline bool furi_hal_Wi2c_rx( + FuriHalI2cBusHandle* const bus, + const uint8_t addr, + void* buf, + const size_t len, + const uint32_t tmo) { + furi_hal_i2c_acquire(bus); + bool rv = furi_hal_i2c_rx(bus, addr, buf, len, tmo); + furi_hal_i2c_release(bus); + return rv; +} - //+============================================================================ - static inline - bool furi_hal_Wi2c_trx ( FuriHalI2cBusHandle* const bus, const uint8_t addr, - const void* tx, const size_t txlen, - void* rx, const size_t rxlen, const uint32_t tmo ) - { - bool rv = furi_hal_Wi2c_tx(bus, addr, tx, txlen, tmo); - if (rv) rv = furi_hal_Wi2c_rx(bus, addr, rx, rxlen, tmo); - return rv; - } +//+============================================================================ +static inline bool furi_hal_Wi2c_trx( + FuriHalI2cBusHandle* const bus, + const uint8_t addr, + const void* tx, + const size_t txlen, + void* rx, + const size_t rxlen, + const uint32_t tmo) { + bool rv = furi_hal_Wi2c_tx(bus, addr, tx, txlen, tmo); + if(rv) rv = furi_hal_Wi2c_rx(bus, addr, rx, rxlen, tmo); + return rv; +} - //----------------------------------------------------------------------------- ---------------------------------------- -# define furi_hal_i2c_is_device_ready(...) furi_hal_Wi2c_is_device_ready(__VA_ARGS__) -# define furi_hal_i2c_tx(...) furi_hal_Wi2c_tx(__VA_ARGS__) -# define furi_hal_i2c_rx(...) furi_hal_Wi2c_rx(__VA_ARGS__) -# define furi_hal_i2c_trx(...) furi_hal_Wi2c_trx(__VA_ARGS__) +//----------------------------------------------------------------------------- ---------------------------------------- +#define furi_hal_i2c_is_device_ready(...) furi_hal_Wi2c_is_device_ready(__VA_ARGS__) +#define furi_hal_i2c_tx(...) furi_hal_Wi2c_tx(__VA_ARGS__) +#define furi_hal_i2c_rx(...) furi_hal_Wi2c_rx(__VA_ARGS__) +#define furi_hal_i2c_trx(...) furi_hal_Wi2c_trx(__VA_ARGS__) #endif //ENABLE_WORKAROUND @@ -103,17 +111,21 @@ void furi_hal_i2c_release (FuriHalI2cBusHandle* handle) // Some devices take a moment to respond to read requests // The puts a delay between the address being set and the data being read // -static inline -bool furi_hal_i2c_trxd ( FuriHalI2cBusHandle* const bus, const uint8_t addr, - const void* tx, const size_t txlen, - void* rx, const size_t rxlen, const uint32_t tmo, const uint32_t us ) -{ - bool rv = furi_hal_i2c_tx(bus, addr, tx, txlen, tmo); - if (rv) { - furi_delay_us(us); - rv = furi_hal_i2c_rx(bus, addr, rx, rxlen, tmo); - } - return rv; +static inline bool furi_hal_i2c_trxd( + FuriHalI2cBusHandle* const bus, + const uint8_t addr, + const void* tx, + const size_t txlen, + void* rx, + const size_t rxlen, + const uint32_t tmo, + const uint32_t us) { + bool rv = furi_hal_i2c_tx(bus, addr, tx, txlen, tmo); + if(rv) { + furi_delay_us(us); + rv = furi_hal_i2c_rx(bus, addr, rx, rxlen, tmo); + } + return rv; } #endif //I2C_WORKAROUND_H_ diff --git a/applications/plugins/wii_ec_anal/wii_anal.c b/applications/plugins/wii_ec_anal/wii_anal.c index fdf718b63..f0af1c9c5 100644 --- a/applications/plugins/wii_ec_anal/wii_anal.c +++ b/applications/plugins/wii_ec_anal/wii_anal.c @@ -3,34 +3,34 @@ // // System libs -#include // malloc -#include // uint32_t -#include // __VA_ARGS__ -#include -#include +#include // malloc +#include // uint32_t +#include // __VA_ARGS__ +#include +#include // FlipperZero libs -#include // Core API -#include // GUI (screen/keyboard) API -#include // GUI Input extensions -#include +#include // Core API +#include // GUI (screen/keyboard) API +#include // GUI Input extensions +#include // Do this first! #define ERR_C_ // Do this in precisely ONE file -#include "err.h" // Error numbers & messages +#include "err.h" // Error numbers & messages -#include "bc_logging.h" +#include "bc_logging.h" // Local headers -#include "wii_anal.h" // Various enums and struct declarations -#include "wii_i2c.h" // Wii i2c functions -#include "wii_ec.h" // Wii Extension Controller functions (eg. draw) -#include "wii_anal_keys.h" // key mappings -#include "gfx/images.h" // Images -#include "wii_anal_lcd.h" // Drawing functions -#include "wii_anal_ec.h" // Wii controller events +#include "wii_anal.h" // Various enums and struct declarations +#include "wii_i2c.h" // Wii i2c functions +#include "wii_ec.h" // Wii Extension Controller functions (eg. draw) +#include "wii_anal_keys.h" // key mappings +#include "gfx/images.h" // Images +#include "wii_anal_lcd.h" // Drawing functions +#include "wii_anal_ec.h" // Wii controller events -#include "wii_anal_ver.h" // Version number +#include "wii_anal_ver.h" // Version number //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OOOOO // SSSSS CCCCC AAA L L BBBB AAA CCCC K K SSSSS @@ -44,48 +44,42 @@ // OS Callback : Timer tick // We register this function to be called when the OS signals a timer 'tick' event // -static -void cbTimer (FuriMessageQueue* queue) -{ - ENTER; - furi_assert(queue); +static void cbTimer(FuriMessageQueue* queue) { + ENTER; + furi_assert(queue); - eventMsg_t message = {.id = EVID_TICK}; - furi_message_queue_put(queue, &message, 0); + eventMsg_t message = {.id = EVID_TICK}; + furi_message_queue_put(queue, &message, 0); - LEAVE; - return; + LEAVE; + return; } //+============================================================================ ======================================== // OS Callback : Keypress // We register this function to be called when the OS detects a keypress // -static -void cbInput (InputEvent* event, FuriMessageQueue* queue) -{ - ENTER; - furi_assert(queue); - furi_assert(event); +static void cbInput(InputEvent* event, FuriMessageQueue* queue) { + ENTER; + furi_assert(queue); + furi_assert(event); - // Put an "input" event message on the message queue - eventMsg_t message = {.id = EVID_KEY, .input = *event}; - furi_message_queue_put(queue, &message, FuriWaitForever); + // Put an "input" event message on the message queue + eventMsg_t message = {.id = EVID_KEY, .input = *event}; + furi_message_queue_put(queue, &message, FuriWaitForever); - LEAVE; - return; + LEAVE; + return; } //+============================================================================ // Show version number // -static -void showVer (Canvas* const canvas) -{ - show(canvas, 0,59, &img_3x5_v, SHOW_SET_BLK); - show(canvas, 4,59, VER_MAJ, SHOW_SET_BLK); - canvas_draw_frame(canvas, 8,62, 2,2); - show(canvas, 11,59, VER_MIN, SHOW_SET_BLK); +static void showVer(Canvas* const canvas) { + show(canvas, 0, 59, &img_3x5_v, SHOW_SET_BLK); + show(canvas, 4, 59, VER_MAJ, SHOW_SET_BLK); + canvas_draw_frame(canvas, 8, 62, 2, 2); + show(canvas, 11, 59, VER_MIN, SHOW_SET_BLK); } //+============================================================================ @@ -95,105 +89,103 @@ void showVer (Canvas* const canvas) // We actually instruct the OS to perform this request, after we update the interface // I guess it's possible that this instruction may able be issued by other threads !? // -static -void cbDraw (Canvas* const canvas, void* ctx) -{ - ENTER; - furi_assert(canvas); - furi_assert(ctx); +static void cbDraw(Canvas* const canvas, void* ctx) { + ENTER; + furi_assert(canvas); + furi_assert(ctx); - state_t* state = NULL; + state_t* state = NULL; - // Try to acquire the mutex for the plugin state variables, timeout = 25mS - if ( !(state = (state_t*)acquire_mutex((ValueMutex*)ctx, 25)) ) return ; + // Try to acquire the mutex for the plugin state variables, timeout = 25mS + if(!(state = (state_t*)acquire_mutex((ValueMutex*)ctx, 25))) return; - switch (state->scene) { - //--------------------------------------------------------------------- - case SCENE_SPLASH: - show(canvas, 2,0, &img_csLogo_FULL, SHOW_SET_BLK); + switch(state->scene) { + //--------------------------------------------------------------------- + case SCENE_SPLASH: + show(canvas, 2, 0, &img_csLogo_FULL, SHOW_SET_BLK); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str_aligned(canvas, 64,43, AlignCenter, AlignTop, "Wii Extension Controller"); - canvas_draw_str_aligned(canvas, 64,55, AlignCenter, AlignTop, "Protocol Analyser"); + canvas_set_font(canvas, FontSecondary); + canvas_draw_str_aligned(canvas, 64, 43, AlignCenter, AlignTop, "Wii Extension Controller"); + canvas_draw_str_aligned(canvas, 64, 55, AlignCenter, AlignTop, "Protocol Analyser"); - showVer(canvas); + showVer(canvas); - break; + break; - //--------------------------------------------------------------------- - case SCENE_RIP: - show(canvas, 0,0, &img_RIP, SHOW_SET_BLK); - break; + //--------------------------------------------------------------------- + case SCENE_RIP: + show(canvas, 0, 0, &img_RIP, SHOW_SET_BLK); + break; - //--------------------------------------------------------------------- - case SCENE_WAIT: -# define xo 2 + //--------------------------------------------------------------------- + case SCENE_WAIT: +#define xo 2 - show(canvas, 3+xo,10, &img_ecp_port, SHOW_SET_BLK); + show(canvas, 3 + xo, 10, &img_ecp_port, SHOW_SET_BLK); - BOX_TL(22+xo, 6, 82+xo,23); // 3v3 - BOX_TL(48+xo,21, 82+xo,23); // C1 - BOX_BL(22+xo,41, 82+xo,58); // C0 - BOX_BL(48+xo,41, 82+xo,44); // Gnd + BOX_TL(22 + xo, 6, 82 + xo, 23); // 3v3 + BOX_TL(48 + xo, 21, 82 + xo, 23); // C1 + BOX_BL(22 + xo, 41, 82 + xo, 58); // C0 + BOX_BL(48 + xo, 41, 82 + xo, 44); // Gnd - show(canvas, 90+xo, 3, &img_6x8_3, SHOW_SET_BLK); // 3v3 - show(canvas, 97+xo, 3, &img_6x8_v, SHOW_SET_BLK); - show(canvas, 104+xo, 3, &img_6x8_3, SHOW_SET_BLK); + show(canvas, 90 + xo, 3, &img_6x8_3, SHOW_SET_BLK); // 3v3 + show(canvas, 97 + xo, 3, &img_6x8_v, SHOW_SET_BLK); + show(canvas, 104 + xo, 3, &img_6x8_3, SHOW_SET_BLK); - show(canvas, 90+xo,18, &img_6x8_C, SHOW_SET_BLK); // C1 <-> - show(canvas, 98+xo,18, &img_6x8_1, SHOW_SET_BLK); - show(canvas, 107+xo,16, &img_ecp_SDA, SHOW_SET_BLK); + show(canvas, 90 + xo, 18, &img_6x8_C, SHOW_SET_BLK); // C1 <-> + show(canvas, 98 + xo, 18, &img_6x8_1, SHOW_SET_BLK); + show(canvas, 107 + xo, 16, &img_ecp_SDA, SHOW_SET_BLK); - show(canvas, 90+xo,40, &img_6x8_G, SHOW_SET_BLK); // Gnd - show(canvas, 97+xo,40, &img_6x8_n, SHOW_SET_BLK); - show(canvas, 104+xo,40, &img_6x8_d, SHOW_SET_BLK); + show(canvas, 90 + xo, 40, &img_6x8_G, SHOW_SET_BLK); // Gnd + show(canvas, 97 + xo, 40, &img_6x8_n, SHOW_SET_BLK); + show(canvas, 104 + xo, 40, &img_6x8_d, SHOW_SET_BLK); - show(canvas, 90+xo,54, &img_6x8_C, SHOW_SET_BLK); // C0 _-_- - show(canvas, 98+xo,54, &img_6x8_0, SHOW_SET_BLK); - show(canvas, 108+xo,54, &img_ecp_SCL, SHOW_SET_BLK); + show(canvas, 90 + xo, 54, &img_6x8_C, SHOW_SET_BLK); // C0 _-_- + show(canvas, 98 + xo, 54, &img_6x8_0, SHOW_SET_BLK); + show(canvas, 108 + xo, 54, &img_ecp_SCL, SHOW_SET_BLK); - show(canvas, 0,0, &img_csLogo_Small, SHOW_SET_BLK); - showVer(canvas); + show(canvas, 0, 0, &img_csLogo_Small, SHOW_SET_BLK); + showVer(canvas); -# undef xo - break; +#undef xo + break; - //--------------------------------------------------------------------- - case SCENE_DEBUG: - canvas_set_font(canvas, FontSecondary); + //--------------------------------------------------------------------- + case SCENE_DEBUG: + canvas_set_font(canvas, FontSecondary); - show(canvas, 0,0, &img_key_U, SHOW_SET_BLK); - canvas_draw_str_aligned(canvas, 11, 0, AlignLeft, AlignTop, "Initialise Perhipheral"); + show(canvas, 0, 0, &img_key_U, SHOW_SET_BLK); + canvas_draw_str_aligned(canvas, 11, 0, AlignLeft, AlignTop, "Initialise Perhipheral"); - show(canvas, 0,11, &img_key_OK, SHOW_SET_BLK); - canvas_draw_str_aligned(canvas, 11,11, AlignLeft, AlignTop, "Read values [see log]"); + show(canvas, 0, 11, &img_key_OK, SHOW_SET_BLK); + canvas_draw_str_aligned(canvas, 11, 11, AlignLeft, AlignTop, "Read values [see log]"); - show(canvas, 0,23, &img_key_D, SHOW_SET_BLK); - canvas_draw_str_aligned(canvas, 11,22, AlignLeft, AlignTop, "Restart Scanner"); + show(canvas, 0, 23, &img_key_D, SHOW_SET_BLK); + canvas_draw_str_aligned(canvas, 11, 22, AlignLeft, AlignTop, "Restart Scanner"); - show(canvas, 0,33, &img_key_Back, SHOW_SET_BLK); - canvas_draw_str_aligned(canvas, 11,33, AlignLeft, AlignTop, "Exit"); + show(canvas, 0, 33, &img_key_Back, SHOW_SET_BLK); + canvas_draw_str_aligned(canvas, 11, 33, AlignLeft, AlignTop, "Exit"); - break ; + break; - //--------------------------------------------------------------------- - default: - if (state->ec.pidx >= PID_ERROR) { - ERROR("%s : bad PID = %d", __func__, state->ec.pidx); - } else { - if ((state->scene == SCENE_DUMP) || !ecId[state->ec.pidx].show) - ecId[PID_UNKNOWN].show(canvas, state); - else - ecId[state->ec.pidx].show(canvas, state); - } - break; - } + //--------------------------------------------------------------------- + default: + if(state->ec.pidx >= PID_ERROR) { + ERROR("%s : bad PID = %d", __func__, state->ec.pidx); + } else { + if((state->scene == SCENE_DUMP) || !ecId[state->ec.pidx].show) + ecId[PID_UNKNOWN].show(canvas, state); + else + ecId[state->ec.pidx].show(canvas, state); + } + break; + } - // Release the mutex - release_mutex((ValueMutex*)ctx, state); + // Release the mutex + release_mutex((ValueMutex*)ctx, state); - LEAVE; - return; + LEAVE; + return; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -207,56 +199,54 @@ void cbDraw (Canvas* const canvas, void* ctx) //+============================================================================ ======================================== // Initialise plugin state variables // -static inline -bool stateInit (state_t* const state) -{ - ENTER; - furi_assert(state); +static inline bool stateInit(state_t* const state) { + ENTER; + furi_assert(state); - bool rv = true; // assume success + bool rv = true; // assume success - // Enable the main loop - state->run = true; + // Enable the main loop + state->run = true; - // Timer - state->timerEn = false; - state->timer = NULL; - state->timerHz = furi_kernel_get_tick_frequency(); - state->fps = 30; + // Timer + state->timerEn = false; + state->timer = NULL; + state->timerHz = furi_kernel_get_tick_frequency(); + state->fps = 30; - // Scene - state->scene = SCENE_SPLASH; - state->scenePrev = SCENE_NONE; - state->scenePegg = SCENE_NONE; + // Scene + state->scene = SCENE_SPLASH; + state->scenePrev = SCENE_NONE; + state->scenePegg = SCENE_NONE; - state->hold = 0; // show hold meters (-1=lowest, 0=current, +1=highest} - state->calib = CAL_TRACK; - state->pause = false; // animation running - state->apause = false; // auto-pause animation + state->hold = 0; // show hold meters (-1=lowest, 0=current, +1=highest} + state->calib = CAL_TRACK; + state->pause = false; // animation running + state->apause = false; // auto-pause animation - // Notifications - state->notify = NULL; + // Notifications + state->notify = NULL; - // Perhipheral - state->ec.init = false; - state->ec.pidx = PID_UNKNOWN; - state->ec.sid = ecId[state->ec.pidx].name; + // Perhipheral + state->ec.init = false; + state->ec.pidx = PID_UNKNOWN; + state->ec.sid = ecId[state->ec.pidx].name; - // Controller data - memset(state->ec.pid, 0xC5, PID_LEN); // Cyborg 5ystems - memset(state->ec.calF, 0xC5, CAL_LEN); - memset(state->ec.joy, 0xC5, JOY_LEN); + // Controller data + memset(state->ec.pid, 0xC5, PID_LEN); // Cyborg 5ystems + memset(state->ec.calF, 0xC5, CAL_LEN); + memset(state->ec.joy, 0xC5, JOY_LEN); - // Encryption details - state->ec.encrypt = false; - memset(state->ec.encKey, 0x00, ENC_LEN); + // Encryption details + state->ec.encrypt = false; + memset(state->ec.encKey, 0x00, ENC_LEN); - // Seed the PRNG - // CYCCNT --> lib/STM32CubeWB/Drivers/CMSIS/Include/core_cm7.h -// srand(DWT->CYCCNT); + // Seed the PRNG + // CYCCNT --> lib/STM32CubeWB/Drivers/CMSIS/Include/core_cm7.h + // srand(DWT->CYCCNT); - LEAVE; - return rv; + LEAVE; + return rv; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -270,271 +260,284 @@ bool stateInit (state_t* const state) //+============================================================================ ======================================== // Enable/Disable scanning // -void timerEn (state_t* state, bool on) -{ - ENTER; - furi_assert(state); +void timerEn(state_t* state, bool on) { + ENTER; + furi_assert(state); - // ENable scanning - if (on) { - if (state->timerEn) { - WARN(wii_errs[WARN_SCAN_START]); - } else { - // Set the timer to fire at 'fps' times/second - if (furi_timer_start(state->timer, state->timerHz/state->fps) == FuriStatusOk) { - state->timerEn = true; - INFO("%s : monitor started", __func__); - } else { - ERROR(wii_errs[ERR_TIMER_START]); - } - } + // ENable scanning + if(on) { + if(state->timerEn) { + WARN(wii_errs[WARN_SCAN_START]); + } else { + // Set the timer to fire at 'fps' times/second + if(furi_timer_start(state->timer, state->timerHz / state->fps) == FuriStatusOk) { + state->timerEn = true; + INFO("%s : monitor started", __func__); + } else { + ERROR(wii_errs[ERR_TIMER_START]); + } + } - // DISable scanning - } else { - if (!state->timerEn) { - WARN(wii_errs[WARN_SCAN_STOP]); - } else { - // Stop the timer - if (furi_timer_stop(state->timer) == FuriStatusOk) { - state->timerEn = false; - INFO("%s : monitor stopped", __func__); - } else { - ERROR(wii_errs[ERR_TIMER_STOP]); - } - } - } + // DISable scanning + } else { + if(!state->timerEn) { + WARN(wii_errs[WARN_SCAN_STOP]); + } else { + // Stop the timer + if(furi_timer_stop(state->timer) == FuriStatusOk) { + state->timerEn = false; + INFO("%s : monitor stopped", __func__); + } else { + ERROR(wii_errs[ERR_TIMER_STOP]); + } + } + } - LEAVE; - return; + LEAVE; + return; } //+============================================================================ ======================================== // Plugin entry point // -int32_t wii_ec_anal (void) -{ - ENTER; +int32_t wii_ec_anal(void) { + ENTER; - // ===== Variables ===== - err_t error = 0; // assume success - Gui* gui = NULL; - ViewPort* vpp = NULL; - state_t* state = NULL; - ValueMutex mutex = {0}; - FuriMessageQueue* queue = NULL; - const uint32_t queueSz = 20; // maximum messages in queue - uint32_t tmo = (3.5f *1000); // timeout splash screen after N seconds + // ===== Variables ===== + err_t error = 0; // assume success + Gui* gui = NULL; + ViewPort* vpp = NULL; + state_t* state = NULL; + ValueMutex mutex = {0}; + FuriMessageQueue* queue = NULL; + const uint32_t queueSz = 20; // maximum messages in queue + uint32_t tmo = (3.5f * 1000); // timeout splash screen after N seconds - // The queue will contain plugin event-messages - // --> local - eventMsg_t msg = {0}; + // The queue will contain plugin event-messages + // --> local + eventMsg_t msg = {0}; - INFO("BEGIN"); + INFO("BEGIN"); - // ===== Message queue ===== - // 1. Create a message queue (for up to 8 (keyboard) event messages) - if ( !(queue = furi_message_queue_alloc(queueSz, sizeof(msg))) ) { - ERROR(wii_errs[(error = ERR_MALLOC_QUEUE)]); - goto bail; - } + // ===== Message queue ===== + // 1. Create a message queue (for up to 8 (keyboard) event messages) + if(!(queue = furi_message_queue_alloc(queueSz, sizeof(msg)))) { + ERROR(wii_errs[(error = ERR_MALLOC_QUEUE)]); + goto bail; + } - // ===== Create GUI Interface ===== - // 2. Create a GUI interface - if ( !(gui = furi_record_open("gui")) ) { - ERROR(wii_errs[(error = ERR_NO_GUI)]); - goto bail; - } + // ===== Create GUI Interface ===== + // 2. Create a GUI interface + if(!(gui = furi_record_open("gui"))) { + ERROR(wii_errs[(error = ERR_NO_GUI)]); + goto bail; + } - // ===== Plugin state variables ===== - // 3. Allocate space on the heap for the plugin state variables - if ( !(state = malloc(sizeof(state_t))) ) { - ERROR(wii_errs[(error = ERR_MALLOC_STATE)]); - goto bail; - } - // 4. Initialise the plugin state variables - if (!stateInit(state)) { - // error message(s) is/are output by stateInit() - error = 15; - goto bail; - } - // 5. Create a mutex for (reading/writing) the plugin state variables - if (!init_mutex(&mutex, state, sizeof(state))) { - ERROR(wii_errs[(error = ERR_NO_MUTEX)]); - goto bail; - } + // ===== Plugin state variables ===== + // 3. Allocate space on the heap for the plugin state variables + if(!(state = malloc(sizeof(state_t)))) { + ERROR(wii_errs[(error = ERR_MALLOC_STATE)]); + goto bail; + } + // 4. Initialise the plugin state variables + if(!stateInit(state)) { + // error message(s) is/are output by stateInit() + error = 15; + goto bail; + } + // 5. Create a mutex for (reading/writing) the plugin state variables + if(!init_mutex(&mutex, state, sizeof(state))) { + ERROR(wii_errs[(error = ERR_NO_MUTEX)]); + goto bail; + } - // ===== Viewport ===== - // 6. Allocate space on the heap for the viewport - if ( !(vpp = view_port_alloc()) ) { - ERROR(wii_errs[(error = ERR_MALLOC_VIEW)]); - goto bail; - } - // 7a. Register a callback for input events - view_port_input_callback_set(vpp, cbInput, queue); - // 7b. Register a callback for draw events - view_port_draw_callback_set(vpp, cbDraw, &mutex); + // ===== Viewport ===== + // 6. Allocate space on the heap for the viewport + if(!(vpp = view_port_alloc())) { + ERROR(wii_errs[(error = ERR_MALLOC_VIEW)]); + goto bail; + } + // 7a. Register a callback for input events + view_port_input_callback_set(vpp, cbInput, queue); + // 7b. Register a callback for draw events + view_port_draw_callback_set(vpp, cbDraw, &mutex); - // ===== Start GUI Interface ===== - // 8. Attach the viewport to the GUI - gui_add_view_port(gui, vpp, GuiLayerFullscreen); + // ===== Start GUI Interface ===== + // 8. Attach the viewport to the GUI + gui_add_view_port(gui, vpp, GuiLayerFullscreen); - // ===== Timer ===== - // 9. Allocate a timer - if ( !(state->timer = furi_timer_alloc(cbTimer, FuriTimerTypePeriodic, queue)) ) { - ERROR(wii_errs[(error = ERR_NO_TIMER)]); - goto bail; - } + // ===== Timer ===== + // 9. Allocate a timer + if(!(state->timer = furi_timer_alloc(cbTimer, FuriTimerTypePeriodic, queue))) { + ERROR(wii_errs[(error = ERR_NO_TIMER)]); + goto bail; + } - // === System Notifications === - // 10. Acquire a handle for the system notification queue - if ( !(state->notify = furi_record_open(RECORD_NOTIFICATION)) ) { - ERROR(wii_errs[(error = ERR_NO_NOTIFY)]); - goto bail; - } - patBacklight(state); // Turn on the backlight [qv. remote FAP launch] + // === System Notifications === + // 10. Acquire a handle for the system notification queue + if(!(state->notify = furi_record_open(RECORD_NOTIFICATION))) { + ERROR(wii_errs[(error = ERR_NO_NOTIFY)]); + goto bail; + } + patBacklight(state); // Turn on the backlight [qv. remote FAP launch] - INFO("INITIALISED"); + INFO("INITIALISED"); - // ==================== Main event loop ==================== + // ==================== Main event loop ==================== - if (state->run) do { - bool redraw = false; - FuriStatus status = FuriStatusErrorTimeout; + if(state->run) do { + bool redraw = false; + FuriStatus status = FuriStatusErrorTimeout; - // Wait for a message -// while ((status = furi_message_queue_get(queue, &msg, tmo)) == FuriStatusErrorTimeout) ; - status = furi_message_queue_get(queue, &msg, tmo); + // Wait for a message + // while ((status = furi_message_queue_get(queue, &msg, tmo)) == FuriStatusErrorTimeout) ; + status = furi_message_queue_get(queue, &msg, tmo); - // Clear splash screen - if ( (state->scene == SCENE_SPLASH) && (state->scenePrev == SCENE_NONE) && // Initial splash - ( (status == FuriStatusErrorTimeout) || // timeout - ((msg.id == EVID_KEY) && (msg.input.type == InputTypeShort)) ) // or key-short - ) { - tmo = 60 *1000; // increase message-wait timeout to 60secs - timerEn(state, true); // start scanning the i2c bus - status = FuriStatusOk; // pass status check - msg.id = EVID_NONE; // valid msg ID - sceneSet(state, SCENE_WAIT); // move to wait screen - } + // Clear splash screen + if((state->scene == SCENE_SPLASH) && + (state->scenePrev == SCENE_NONE) && // Initial splash + ((status == FuriStatusErrorTimeout) || // timeout + ((msg.id == EVID_KEY) && (msg.input.type == InputTypeShort))) // or key-short + ) { + tmo = 60 * 1000; // increase message-wait timeout to 60secs + timerEn(state, true); // start scanning the i2c bus + status = FuriStatusOk; // pass status check + msg.id = EVID_NONE; // valid msg ID + sceneSet(state, SCENE_WAIT); // move to wait screen + } - // Check for queue errors - if (status != FuriStatusOk) { - switch (status) { - case FuriStatusErrorTimeout: DEBUG(wii_errs[DEBUG_QUEUE_TIMEOUT]); continue ; - case FuriStatusError: ERROR(wii_errs[(error = ERR_QUEUE_RTOS)]); goto bail ; - case FuriStatusErrorResource: ERROR(wii_errs[(error = ERR_QUEUE_RESOURCE)]); goto bail ; - case FuriStatusErrorParameter: ERROR(wii_errs[(error = ERR_QUEUE_BADPRM)]); goto bail ; - case FuriStatusErrorNoMemory: ERROR(wii_errs[(error = ERR_QUEUE_NOMEM)]); goto bail ; - case FuriStatusErrorISR: ERROR(wii_errs[(error = ERR_QUEUE_ISR)]); goto bail ; - default: ERROR(wii_errs[(error = ERR_QUEUE_UNK)]); goto bail ; - } - } - // Read successful + // Check for queue errors + if(status != FuriStatusOk) { + switch(status) { + case FuriStatusErrorTimeout: + DEBUG(wii_errs[DEBUG_QUEUE_TIMEOUT]); + continue; + case FuriStatusError: + ERROR(wii_errs[(error = ERR_QUEUE_RTOS)]); + goto bail; + case FuriStatusErrorResource: + ERROR(wii_errs[(error = ERR_QUEUE_RESOURCE)]); + goto bail; + case FuriStatusErrorParameter: + ERROR(wii_errs[(error = ERR_QUEUE_BADPRM)]); + goto bail; + case FuriStatusErrorNoMemory: + ERROR(wii_errs[(error = ERR_QUEUE_NOMEM)]); + goto bail; + case FuriStatusErrorISR: + ERROR(wii_errs[(error = ERR_QUEUE_ISR)]); + goto bail; + default: + ERROR(wii_errs[(error = ERR_QUEUE_UNK)]); + goto bail; + } + } + // Read successful - // *** Try to lock the plugin state variables *** - if ( !(state = (state_t*)acquire_mutex_block(&mutex)) ) { - ERROR(wii_errs[(error = ERR_MUTEX_BLOCK)]); - goto bail; - } + // *** Try to lock the plugin state variables *** + if(!(state = (state_t*)acquire_mutex_block(&mutex))) { + ERROR(wii_errs[(error = ERR_MUTEX_BLOCK)]); + goto bail; + } - // *** Handle events *** - switch (msg.id) { - //--------------------------------------------- - case EVID_TICK: // Timer events - //! I would prefer to have ecPoll() called by cbTimer() - //! ...but how does cbTimer() get the required access to the state variables? Namely: 'state->ec' - //! So, for now, the timer pushes a message to call ecPoll() - //! which, in turn, will push WIIEC event meesages! - ecPoll(&state->ec, queue); - break; + // *** Handle events *** + switch(msg.id) { + //--------------------------------------------- + case EVID_TICK: // Timer events + //! I would prefer to have ecPoll() called by cbTimer() + //! ...but how does cbTimer() get the required access to the state variables? Namely: 'state->ec' + //! So, for now, the timer pushes a message to call ecPoll() + //! which, in turn, will push WIIEC event meesages! + ecPoll(&state->ec, queue); + break; - //--------------------------------------------- - case EVID_WIIEC: // WiiMote Perhipheral - if (evWiiEC(&msg, state)) redraw = true ; - break; + //--------------------------------------------- + case EVID_WIIEC: // WiiMote Perhipheral + if(evWiiEC(&msg, state)) redraw = true; + break; - //--------------------------------------------- - case EVID_KEY: // Key events - patBacklight(state); - if (evKey(&msg, state)) redraw = true; - break; + //--------------------------------------------- + case EVID_KEY: // Key events + patBacklight(state); + if(evKey(&msg, state)) redraw = true; + break; - //--------------------------------------------- - case EVID_NONE: - break; + //--------------------------------------------- + case EVID_NONE: + break; - //--------------------------------------------- - default: // Unknown event - WARN("Unknown message.ID [%d]", msg.id); - break; - } + //--------------------------------------------- + default: // Unknown event + WARN("Unknown message.ID [%d]", msg.id); + break; + } - // *** Update the GUI screen via the viewport *** - if (redraw) view_port_update(vpp) ; + // *** Update the GUI screen via the viewport *** + if(redraw) view_port_update(vpp); - // *** Try to release the plugin state variables *** - if ( !release_mutex(&mutex, state) ) { - ERROR(wii_errs[(error = ERR_MUTEX_RELEASE)]); - goto bail; - } - } while (state->run); + // *** Try to release the plugin state variables *** + if(!release_mutex(&mutex, state)) { + ERROR(wii_errs[(error = ERR_MUTEX_RELEASE)]); + goto bail; + } + } while(state->run); - // ===== Game Over ===== - INFO("USER EXIT"); + // ===== Game Over ===== + INFO("USER EXIT"); bail: - // 10. Release system notification queue - if (state->notify) { - furi_record_close(RECORD_NOTIFICATION); - state->notify = NULL; - } + // 10. Release system notification queue + if(state->notify) { + furi_record_close(RECORD_NOTIFICATION); + state->notify = NULL; + } - // 9. Stop the timer - if (state->timer) { - (void)furi_timer_stop(state->timer); - furi_timer_free(state->timer); - state->timer = NULL; - state->timerEn = false; - } + // 9. Stop the timer + if(state->timer) { + (void)furi_timer_stop(state->timer); + furi_timer_free(state->timer); + state->timer = NULL; + state->timerEn = false; + } - // 8. Detach the viewport - gui_remove_view_port(gui, vpp); + // 8. Detach the viewport + gui_remove_view_port(gui, vpp); - // 7. No need to unreqgister the callbacks - // ...they will go when the viewport is destroyed + // 7. No need to unreqgister the callbacks + // ...they will go when the viewport is destroyed - // 6. Destroy the viewport - if (vpp) { - view_port_enabled_set(vpp, false); - view_port_free(vpp); - vpp = NULL; - } + // 6. Destroy the viewport + if(vpp) { + view_port_enabled_set(vpp, false); + view_port_free(vpp); + vpp = NULL; + } - // 5. Free the mutex - if (mutex.mutex) { - delete_mutex(&mutex); - mutex.mutex = NULL; - } + // 5. Free the mutex + if(mutex.mutex) { + delete_mutex(&mutex); + mutex.mutex = NULL; + } - // 4. Free up state pointer(s) - // none + // 4. Free up state pointer(s) + // none - // 3. Free the plugin state variables - if (state) { - free(state); - state = NULL; - } + // 3. Free the plugin state variables + if(state) { + free(state); + state = NULL; + } - // 2. Close the GUI - furi_record_close("gui"); + // 2. Close the GUI + furi_record_close("gui"); - // 1. Destroy the message queue - if (queue) { - furi_message_queue_free(queue); - queue = NULL; - } + // 1. Destroy the message queue + if(queue) { + furi_message_queue_free(queue); + queue = NULL; + } - INFO("CLEAN EXIT ... Exit code: %d", error); - LEAVE; - return (int32_t)error; + INFO("CLEAN EXIT ... Exit code: %d", error); + LEAVE; + return (int32_t)error; } diff --git a/applications/plugins/wii_ec_anal/wii_anal.h b/applications/plugins/wii_ec_anal/wii_anal.h index ac7ffddb1..3aae61fdc 100644 --- a/applications/plugins/wii_ec_anal/wii_anal.h +++ b/applications/plugins/wii_ec_anal/wii_anal.h @@ -1,97 +1,89 @@ -#ifndef WII_ANAL_H_ -#define WII_ANAL_H_ +#ifndef WII_ANAL_H_ +#define WII_ANAL_H_ -#include // Core API -#include // GUI Input extensions -#include +#include // Core API +#include // GUI Input extensions +#include //----------------------------------------------------------------------------- ---------------------------------------- // GUI scenes // -typedef - enum scene { - SCENE_NONE = 0, - SCENE_SPLASH = 1, - SCENE_RIP = 2, - SCENE_WAIT = 3, - SCENE_DEBUG = 4, - SCENE_DUMP = 5, - SCENE_CLASSIC = 6, - SCENE_CLASSIC_N = 7, - SCENE_NUNCHUCK = 8, - SCENE_NUNCHUCK_ACC = 9, - } -scene_t; +typedef enum scene { + SCENE_NONE = 0, + SCENE_SPLASH = 1, + SCENE_RIP = 2, + SCENE_WAIT = 3, + SCENE_DEBUG = 4, + SCENE_DUMP = 5, + SCENE_CLASSIC = 6, + SCENE_CLASSIC_N = 7, + SCENE_NUNCHUCK = 8, + SCENE_NUNCHUCK_ACC = 9, +} scene_t; //----------------------------------------------------------------------------- ---------------------------------------- -#include "wii_i2c.h" -#include "wii_ec.h" +#include "wii_i2c.h" +#include "wii_ec.h" //----------------------------------------------------------------------------- ---------------------------------------- // A list of event IDs handled by this plugin // -typedef - enum eventID { - EVID_NONE, - EVID_UNKNOWN, +typedef enum eventID { + EVID_NONE, + EVID_UNKNOWN, - // A full list of events can be found with: `grep -r --color "void.*set_.*_callback" applications/gui/*` - // ...A free gift to you from the makers of well written code that conforms to a good coding standard - EVID_KEY, // keypad - EVID_TICK, // tick - EVID_WIIEC, // wii extension controller - } -eventID_t; + // A full list of events can be found with: `grep -r --color "void.*set_.*_callback" applications/gui/*` + // ...A free gift to you from the makers of well written code that conforms to a good coding standard + EVID_KEY, // keypad + EVID_TICK, // tick + EVID_WIIEC, // wii extension controller +} eventID_t; //----------------------------------------------------------------------------- ---------------------------------------- // An item in the event message-queue // -typedef - struct eventMsg { - eventID_t id; - union { - InputEvent input; // --> applications/input/input.h - wiiEcEvent_t wiiEc; // --> local - }; - } -eventMsg_t; +typedef struct eventMsg { + eventID_t id; + union { + InputEvent input; // --> applications/input/input.h + wiiEcEvent_t wiiEc; // --> local + }; +} eventMsg_t; //----------------------------------------------------------------------------- ---------------------------------------- // State variables for this plugin // An instance of this is allocated on the heap, and the pointer is passed back to the OS // Access to this memory is controlled by mutex // -typedef - struct state { - bool run; // true : plugin is running +typedef struct state { + bool run; // true : plugin is running - bool timerEn; // controller scanning enabled - FuriTimer* timer; // the timer - uint32_t timerHz; // system ticks per second - int fps; // poll/refresh [frames]-per-second + bool timerEn; // controller scanning enabled + FuriTimer* timer; // the timer + uint32_t timerHz; // system ticks per second + int fps; // poll/refresh [frames]-per-second - int cnvW; // canvas width - int cnvH; // canvas height - scene_t scene; // current scene - scene_t scenePrev; // previous scene - scene_t scenePegg; // previous scene for easter eggs - int flash; // flash counter (flashing icons) + int cnvW; // canvas width + int cnvH; // canvas height + scene_t scene; // current scene + scene_t scenePrev; // previous scene + scene_t scenePegg; // previous scene for easter eggs + int flash; // flash counter (flashing icons) - int hold; // hold type: {-1=tough-peak, 0=none, +1=peak-hold} - ecCalib_t calib; // Software calibration mode + int hold; // hold type: {-1=tough-peak, 0=none, +1=peak-hold} + ecCalib_t calib; // Software calibration mode - bool pause; // Accelerometer animation pause - bool apause; // Accelerometer animation auto-pause + bool pause; // Accelerometer animation pause + bool apause; // Accelerometer animation auto-pause - NotificationApp* notify; // OS nitifcation queue (for patting the backlight watchdog timer) + NotificationApp* notify; // OS nitifcation queue (for patting the backlight watchdog timer) - wiiEC_t ec; // Extension Controller details - } -state_t; + wiiEC_t ec; // Extension Controller details +} state_t; //============================================================================= ======================================== // Function prototypes // -void timerEn (state_t* state, bool on) ; +void timerEn(state_t* state, bool on); #endif //WII_ANAL_H_ diff --git a/applications/plugins/wii_ec_anal/wii_anal_ec.c b/applications/plugins/wii_ec_anal/wii_anal_ec.c index 94f021289..e93df5366 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_ec.c +++ b/applications/plugins/wii_ec_anal/wii_anal_ec.c @@ -1,85 +1,105 @@ -#include -#include +#include +#include -#include "wii_anal.h" -#include "wii_anal_lcd.h" -#include "wii_anal_keys.h" +#include "wii_anal.h" +#include "wii_anal_lcd.h" +#include "wii_anal_keys.h" //+============================================================================ ======================================== // Handle Wii Extension Controller events // -bool evWiiEC (const eventMsg_t* const msg, state_t* const state) -{ - bool redraw = false; +bool evWiiEC(const eventMsg_t* const msg, state_t* const state) { + bool redraw = false; -# if LOG_LEVEL >= 4 - { - const char* s = NULL; - switch (msg->wiiEc.type) { - case WIIEC_NONE: s = "Error"; break ; - case WIIEC_CONN: s = "Connect"; break ; - case WIIEC_DISCONN: s = "Disconnect"; break ; - case WIIEC_PRESS: s = "Press"; break ; - case WIIEC_RELEASE: s = "Release"; break ; - case WIIEC_ANALOG: s = "Analog"; break ; - case WIIEC_ACCEL: s = "Accel"; break ; - default: s = "Bug"; break ; - } - INFO("WIIP : %s '%c' = %d", s, (isprint((int)msg->wiiEc.in) ? msg->wiiEc.in : '_'), msg->wiiEc.val); - if ((msg->wiiEc.type == WIIEC_CONN) || (msg->wiiEc.type == WIIEC_DISCONN)) - INFO("...%d=\"%s\"", msg->wiiEc.val, ecId[msg->wiiEc.val].name); - } -# endif - - switch (msg->wiiEc.type) { - case WIIEC_CONN: - patBacklight(state); - state->hold = 0; - state->calib = CAL_TRACK; - sceneSet(state, ecId[msg->wiiEc.val].scene); - redraw = true ; - break; - - case WIIEC_DISCONN: - patBacklight(state); - sceneSet(state, SCENE_WAIT); - redraw = true; - break; - - case WIIEC_PRESS: - if (state->scene == SCENE_NUNCHUCK_ACC) switch (msg->wiiEc.in) { - case 'z': // un-pause - state->pause = !state->pause; - break; - case 'c': // toggle auto-pause - state->pause = false; - state->apause = !state->apause; - break; - default: break ; - } - -#if 1 //! factory calibration method not known for classic triggers - this will set the digital switch point - if (state->ec.pidx == PID_CLASSIC) { - if (msg->wiiEc.in == 'l') state->ec.calS.classic[2].trgZL = msg->wiiEc.val ; - if (msg->wiiEc.in == 'r') state->ec.calS.classic[2].trgZR = msg->wiiEc.val ; - } +#if LOG_LEVEL >= 4 + { + const char* s = NULL; + switch(msg->wiiEc.type) { + case WIIEC_NONE: + s = "Error"; + break; + case WIIEC_CONN: + s = "Connect"; + break; + case WIIEC_DISCONN: + s = "Disconnect"; + break; + case WIIEC_PRESS: + s = "Press"; + break; + case WIIEC_RELEASE: + s = "Release"; + break; + case WIIEC_ANALOG: + s = "Analog"; + break; + case WIIEC_ACCEL: + s = "Accel"; + break; + default: + s = "Bug"; + break; + } + INFO( + "WIIP : %s '%c' = %d", + s, + (isprint((int)msg->wiiEc.in) ? msg->wiiEc.in : '_'), + msg->wiiEc.val); + if((msg->wiiEc.type == WIIEC_CONN) || (msg->wiiEc.type == WIIEC_DISCONN)) + INFO("...%d=\"%s\"", msg->wiiEc.val, ecId[msg->wiiEc.val].name); + } #endif - __attribute__ ((fallthrough)); - case WIIEC_RELEASE: - patBacklight(state); - redraw = true; - break; + switch(msg->wiiEc.type) { + case WIIEC_CONN: + patBacklight(state); + state->hold = 0; + state->calib = CAL_TRACK; + sceneSet(state, ecId[msg->wiiEc.val].scene); + redraw = true; + break; - case WIIEC_ANALOG: - case WIIEC_ACCEL: - ecCalibrate(&state->ec, state->calib); - redraw = true; - break; + case WIIEC_DISCONN: + patBacklight(state); + sceneSet(state, SCENE_WAIT); + redraw = true; + break; - default: - break; - } + case WIIEC_PRESS: + if(state->scene == SCENE_NUNCHUCK_ACC) switch(msg->wiiEc.in) { + case 'z': // un-pause + state->pause = !state->pause; + break; + case 'c': // toggle auto-pause + state->pause = false; + state->apause = !state->apause; + break; + default: + break; + } - return redraw; +#if 1 //! factory calibration method not known for classic triggers - this will set the digital switch point + if(state->ec.pidx == PID_CLASSIC) { + if(msg->wiiEc.in == 'l') state->ec.calS.classic[2].trgZL = msg->wiiEc.val; + if(msg->wiiEc.in == 'r') state->ec.calS.classic[2].trgZR = msg->wiiEc.val; + } +#endif + __attribute__((fallthrough)); + + case WIIEC_RELEASE: + patBacklight(state); + redraw = true; + break; + + case WIIEC_ANALOG: + case WIIEC_ACCEL: + ecCalibrate(&state->ec, state->calib); + redraw = true; + break; + + default: + break; + } + + return redraw; } diff --git a/applications/plugins/wii_ec_anal/wii_anal_ec.h b/applications/plugins/wii_ec_anal/wii_anal_ec.h index 886b60281..eec6b523c 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_ec.h +++ b/applications/plugins/wii_ec_anal/wii_anal_ec.h @@ -1,14 +1,14 @@ -#ifndef WII_ANAL_EC_H_ -#define WII_ANAL_EC_H_ +#ifndef WII_ANAL_EC_H_ +#define WII_ANAL_EC_H_ -#include +#include //============================================================================= ======================================== // Function prototypes // -typedef struct eventMsg eventMsg_t ; -typedef struct state state_t ; +typedef struct eventMsg eventMsg_t; +typedef struct state state_t; -bool evWiiEC (const eventMsg_t* const msg, state_t* const state) ; +bool evWiiEC(const eventMsg_t* const msg, state_t* const state); #endif //WII_ANAL_EC_H_ diff --git a/applications/plugins/wii_ec_anal/wii_anal_keys.c b/applications/plugins/wii_ec_anal/wii_anal_keys.c index bcdcf5a62..8c5c99b4e 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_keys.c +++ b/applications/plugins/wii_ec_anal/wii_anal_keys.c @@ -1,40 +1,35 @@ -#include +#include -#include "bc_logging.h" +#include "bc_logging.h" -#include "wii_anal.h" +#include "wii_anal.h" //+============================================================================ ======================================== // Stop Calibration mode // -static -void calStop (state_t* const state) -{ - state->hold = 0; // stop calibration mode - state->calib &= ~(CAL_RANGE | CAL_NOTJOY); // ... +static void calStop(state_t* const state) { + state->hold = 0; // stop calibration mode + state->calib &= ~(CAL_RANGE | CAL_NOTJOY); // ... } //+============================================================================ ======================================== // Change to another scene // -void sceneSet (state_t* const state, const scene_t scene) -{ - calStop(state); // Stop software calibration - state->scenePrev = state->scene; // Remember where we came from - state->scene = scene; // Go to new scene - INFO("Scene : %d -> %d", state->scenePrev, state->scene); +void sceneSet(state_t* const state, const scene_t scene) { + calStop(state); // Stop software calibration + state->scenePrev = state->scene; // Remember where we came from + state->scene = scene; // Go to new scene + INFO("Scene : %d -> %d", state->scenePrev, state->scene); } //+============================================================================ ======================================== // Change to an easter egg scene // -static -void sceneSetEgg (state_t* const state, const scene_t scene) -{ - calStop(state); // Stop software calibration - state->scenePegg = state->scene; // Remember where we came from - state->scene = scene; // Go to new scene - INFO("Scene* : %d => %d", state->scenePegg, state->scene); +static void sceneSetEgg(state_t* const state, const scene_t scene) { + calStop(state); // Stop software calibration + state->scenePegg = state->scene; // Remember where we came from + state->scene = scene; // Go to new scene + INFO("Scene* : %d => %d", state->scenePegg, state->scene); } //+============================================================================ ======================================== @@ -42,254 +37,263 @@ void sceneSetEgg (state_t* const state, const scene_t scene) // Enabling peak-hold on screen with no peak meters will have no effect // So, to avoid code duplication... // -bool key_calib (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +bool key_calib(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyUp: //# hold = (state->hold == +1) ? 0 : +1 ; // toggle peak hold - used = true; - break; + switch(msg->input.type) { + case InputTypeShort: //# input.key) { + case InputKeyUp: //# hold = (state->hold == +1) ? 0 : +1; // toggle peak hold + used = true; + break; - case InputKeyDown: //# hold = (state->hold == -1) ? 0 : -1 ; // toggle trough hold - used = true; - break; + case InputKeyDown: //# hold = (state->hold == -1) ? 0 : -1; // toggle trough hold + used = true; + break; - case InputKeyOk: //# calib & CAL_RANGE) calStop(state) ; // STOP softare calibration - else ecCalibrate(&state->ec, CAL_CENTRE) ; // perform centre calibration - used = true; - break; + case InputKeyOk: //# calib & CAL_RANGE) + calStop(state); // STOP softare calibration + else + ecCalibrate(&state->ec, CAL_CENTRE); // perform centre calibration + used = true; + break; - default: break ; - } - break; + default: + break; + } + break; - case InputTypeLong: //# >! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease - switch (msg->input.key) { - case InputKeyOk: //# >O [ LONG-OK ] - ecCalibrate(&state->ec, CAL_RESET | CAL_CENTRE); // START software calibration - state->hold = 0; - state->calib |= CAL_RANGE; - state->flash = 8; // start with flash ON - used = true; - break; + case InputTypeLong: //# >! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease + switch(msg->input.key) { + case InputKeyOk: //# >O [ LONG-OK ] + ecCalibrate(&state->ec, CAL_RESET | CAL_CENTRE); // START software calibration + state->hold = 0; + state->calib |= CAL_RANGE; + state->flash = 8; // start with flash ON + used = true; + break; - default: break ; - } - break; + default: + break; + } + break; - default: break ; - } + default: + break; + } - return used; + return used; } //+============================================================================ ======================================== // WAIT screen // -static inline -bool wait_key (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +static inline bool wait_key(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - if (msg->input.type == InputTypeShort) { - switch (msg->input.key) { - case InputKeyLeft: //# input.type == InputTypeShort) { + switch(msg->input.key) { + case InputKeyLeft: //# run = false; - used = true; - break; + case InputKeyBack: //# run = false; + used = true; + break; - default: break ; - } - } + default: + break; + } + } - return used; + return used; } //+============================================================================ ======================================== // DEBUG screen // -static inline -bool debug_key (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +static inline bool debug_key(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyUp: { //# ec, NULL); // Initialise the controller //! NULL = no encryption - (void)init; // in case INFO is optimised out - INFO("%s : %s", __func__, (init ? "init OK" : "init fail")); - used = true; - break; - } + switch(msg->input.type) { + case InputTypeShort: //# input.key) { + case InputKeyUp: { //# ec, NULL); // Initialise the controller //! NULL = no encryption + (void)init; // in case INFO is optimised out + INFO("%s : %s", __func__, (init ? "init OK" : "init fail")); + used = true; + break; + } - case InputKeyOk: //# ec) == 0) { // Read the controller - INFO( "%s : joy: {%02X,%02X,%02X,%02X,%02X,%02X}", __func__, - state->ec.joy[0], state->ec.joy[1], state->ec.joy[2], - state->ec.joy[3], state->ec.joy[4], state->ec.joy[5] ); - } - used = true; - break; + case InputKeyOk: //# ec) == 0) { // Read the controller + INFO( + "%s : joy: {%02X,%02X,%02X,%02X,%02X,%02X}", + __func__, + state->ec.joy[0], + state->ec.joy[1], + state->ec.joy[2], + state->ec.joy[3], + state->ec.joy[4], + state->ec.joy[5]); + } + used = true; + break; - case InputKeyDown: //# scenePrev); - used = true; - break; + case InputKeyDown: //# scenePrev); + used = true; + break; - case InputKeyBack: //# run = false; - used = true; - break; + case InputKeyBack: //# run = false; + used = true; + break; - default: break ; //# input.key == InputKeyBack) && (state->scenePrev == SCENE_NONE)) state->run = false ; +static inline bool splash_key(const eventMsg_t* const msg, state_t* const state) { + // Back key on the initial SPLASH screen (this will catch the InputKeyPress) + if((msg->input.key == InputKeyBack) && (state->scenePrev == SCENE_NONE)) state->run = false; - // ANY-other-KEY press - if (msg->input.type == InputTypeShort) { - timerEn(state, true); // Restart the timer - state->scene = state->scenePegg; - } + // ANY-other-KEY press + if(msg->input.type == InputTypeShort) { + timerEn(state, true); // Restart the timer + state->scene = state->scenePegg; + } - return true; + return true; } - //+============================================================================ ======================================== // "_pre" allows the plugin to use the key before the active scene gets a chance // -static inline -bool key_pre (const eventMsg_t* const msg, state_t* const state) -{ - (void)msg; - (void)state; +static inline bool key_pre(const eventMsg_t* const msg, state_t* const state) { + (void)msg; + (void)state; - return false; + return false; } //+============================================================================ ======================================== // "_post" allows the plugin to use a key if it was not used by the active scene // -static inline -bool key_post (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +static inline bool key_post(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - if (msg->input.key == InputKeyBack) { - if (msg->input.type == InputTypeShort) { //# ec.init = false; // reset/disconnect the controller - sceneSet(state, SCENE_WAIT); - used = true; + if(msg->input.key == InputKeyBack) { + if(msg->input.type == InputTypeShort) { //# ec.init = false; // reset/disconnect the controller + sceneSet(state, SCENE_WAIT); + used = true; - } else if (msg->input.type == InputTypeLong) { //# >B [LONG-BACK] - state->run = false; // Signal the plugin to exit - used = true; - } - } + } else if(msg->input.type == InputTypeLong) { //# >B [LONG-BACK] + state->run = false; // Signal the plugin to exit + used = true; + } + } - // Easter eggs - switch (state->scene) { - case SCENE_SPLASH: // Scenes that do NOT offer Easter eggs - case SCENE_RIP: - case SCENE_DEBUG: - break; - default: - if (msg->input.type == InputTypeLong) { - switch (msg->input.key) { - case InputKeyDown: //# >D [LONG-DOWN] - timerEn(state, false); // Stop the timer - sceneSetEgg(state, SCENE_DEBUG); - used = true; - break; + // Easter eggs + switch(state->scene) { + case SCENE_SPLASH: // Scenes that do NOT offer Easter eggs + case SCENE_RIP: + case SCENE_DEBUG: + break; + default: + if(msg->input.type == InputTypeLong) { + switch(msg->input.key) { + case InputKeyDown: //# >D [LONG-DOWN] + timerEn(state, false); // Stop the timer + sceneSetEgg(state, SCENE_DEBUG); + used = true; + break; - case InputKeyLeft: //# >L [ LONG-LEFT ] - timerEn(state, false); // Stop the timer - sceneSetEgg(state, SCENE_SPLASH); - used = true; - break; + case InputKeyLeft: //# >L [ LONG-LEFT ] + timerEn(state, false); // Stop the timer + sceneSetEgg(state, SCENE_SPLASH); + used = true; + break; - case InputKeyUp: //# >U [ LONG-UP ] - timerEn(state, false); // Stop the timer - sceneSetEgg(state, SCENE_RIP); - used = true; - break; + case InputKeyUp: //# >U [ LONG-UP ] + timerEn(state, false); // Stop the timer + sceneSetEgg(state, SCENE_RIP); + used = true; + break; - default: break ; - } - } - break; - } + default: + break; + } + } + break; + } - return used; + return used; } //+============================================================================ ======================================== // Handle a key press event // -bool evKey (const eventMsg_t* const msg, state_t* const state) -{ - furi_assert(msg); - furi_assert(state); +bool evKey(const eventMsg_t* const msg, state_t* const state) { + furi_assert(msg); + furi_assert(state); - bool used = key_pre(msg, state); + bool used = key_pre(msg, state); - if (!used) switch (state->scene) { - case SCENE_SPLASH: //... - case SCENE_RIP: used = splash_key(msg, state); break ; + if(!used) switch(state->scene) { + case SCENE_SPLASH: //... + case SCENE_RIP: + used = splash_key(msg, state); + break; - case SCENE_WAIT: used = wait_key(msg, state); break ; - case SCENE_DEBUG: used = debug_key(msg, state); break ; + case SCENE_WAIT: + used = wait_key(msg, state); + break; + case SCENE_DEBUG: + used = debug_key(msg, state); + break; - default: - if (state->ec.pidx >= PID_ERROR) { - ERROR("%s : bad PID = %d", __func__, state->ec.pidx); - } else { - if ((state->scene == SCENE_DUMP) || !ecId[state->ec.pidx].keys) - ecId[PID_UNKNOWN].keys(msg, state); - else - ecId[state->ec.pidx].keys(msg, state); - } - break; + default: + if(state->ec.pidx >= PID_ERROR) { + ERROR("%s : bad PID = %d", __func__, state->ec.pidx); + } else { + if((state->scene == SCENE_DUMP) || !ecId[state->ec.pidx].keys) + ecId[PID_UNKNOWN].keys(msg, state); + else + ecId[state->ec.pidx].keys(msg, state); + } + break; - case SCENE_NONE: break; - } + case SCENE_NONE: + break; + } - if (!used) used = key_post(msg, state) ; + if(!used) used = key_post(msg, state); - return used; + return used; } - diff --git a/applications/plugins/wii_ec_anal/wii_anal_keys.h b/applications/plugins/wii_ec_anal/wii_anal_keys.h index 0ebbd5e8e..c10fcd1ef 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_keys.h +++ b/applications/plugins/wii_ec_anal/wii_anal_keys.h @@ -1,16 +1,16 @@ -#ifndef WII_ANAL_KEYS_H_ -#define WII_ANAL_KEYS_H_ +#ifndef WII_ANAL_KEYS_H_ +#define WII_ANAL_KEYS_H_ //============================================================================= ======================================== // Function prototypes // -#include // bool -typedef struct eventMsg eventMsg_t ; -typedef struct state state_t ; -typedef enum scene scene_t ; +#include // bool +typedef struct eventMsg eventMsg_t; +typedef struct state state_t; +typedef enum scene scene_t; -void sceneSet (state_t* const state, const scene_t scene) ; -bool key_calib (const eventMsg_t* const msg, state_t* const state) ; -bool evKey (const eventMsg_t* const msg, state_t* const state) ; +void sceneSet(state_t* const state, const scene_t scene); +bool key_calib(const eventMsg_t* const msg, state_t* const state); +bool evKey(const eventMsg_t* const msg, state_t* const state); #endif //WII_ANAL_KEYS_H_ diff --git a/applications/plugins/wii_ec_anal/wii_anal_lcd.c b/applications/plugins/wii_ec_anal/wii_anal_lcd.c index d031bc120..921a3708e 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_lcd.c +++ b/applications/plugins/wii_ec_anal/wii_anal_lcd.c @@ -1,17 +1,45 @@ -#include "wii_anal.h" -#include "gfx/images.h" // Images +#include "wii_anal.h" +#include "gfx/images.h" // Images //----------------------------------------------------------------------------- ---------------------------------------- // A couple of monospaced hex fonts // -const image_t* img_6x8[16] = { - &img_6x8_0, &img_6x8_1, &img_6x8_2, &img_6x8_3, &img_6x8_4, &img_6x8_5, &img_6x8_6, &img_6x8_7, - &img_6x8_8, &img_6x8_9, &img_6x8_A, &img_6x8_B, &img_6x8_C, &img_6x8_D, &img_6x8_E, &img_6x8_F, +const image_t* img_6x8[16] = { + &img_6x8_0, + &img_6x8_1, + &img_6x8_2, + &img_6x8_3, + &img_6x8_4, + &img_6x8_5, + &img_6x8_6, + &img_6x8_7, + &img_6x8_8, + &img_6x8_9, + &img_6x8_A, + &img_6x8_B, + &img_6x8_C, + &img_6x8_D, + &img_6x8_E, + &img_6x8_F, }; -const image_t* img_5x7[16] = { - &img_5x7_0, &img_5x7_1, &img_5x7_2, &img_5x7_3, &img_5x7_4, &img_5x7_5, &img_5x7_6, &img_5x7_7, - &img_5x7_8, &img_5x7_9, &img_5x7_A, &img_5x7_B, &img_5x7_C, &img_5x7_D, &img_5x7_E, &img_5x7_F, +const image_t* img_5x7[16] = { + &img_5x7_0, + &img_5x7_1, + &img_5x7_2, + &img_5x7_3, + &img_5x7_4, + &img_5x7_5, + &img_5x7_6, + &img_5x7_7, + &img_5x7_8, + &img_5x7_9, + &img_5x7_A, + &img_5x7_B, + &img_5x7_C, + &img_5x7_D, + &img_5x7_E, + &img_5x7_F, }; //+============================================================================ ======================================== @@ -30,66 +58,71 @@ const image_t* img_5x7[16] = { // // Do this ONCE ... at plugin quit // furi_record_close(RECORD_NOTIFICATION); // } -void patBacklight (state_t* state) -{ - notification_message(state->notify, &sequence_display_backlight_on); +void patBacklight(state_t* state) { + notification_message(state->notify, &sequence_display_backlight_on); } //============================================================================= ======================================== // Show a hex number in an inverted box (for ananlogue readings) // -void showHex ( Canvas* const canvas, uint8_t x, uint8_t y, - const uint32_t val, const uint8_t cnt, const int b ) -{ - canvas_set_color(canvas, ColorBlack); - canvas_draw_box(canvas, x++,y++, 1 +(cnt *(6 +1)), 10); +void showHex( + Canvas* const canvas, + uint8_t x, + uint8_t y, + const uint32_t val, + const uint8_t cnt, + const int b) { + canvas_set_color(canvas, ColorBlack); + canvas_draw_box(canvas, x++, y++, 1 + (cnt * (6 + 1)), 10); - // thicken border - if (b == 2) canvas_draw_frame(canvas, x-2,y-2, 1 +(cnt *(6 +1))+2, 10+2); + // thicken border + if(b == 2) canvas_draw_frame(canvas, x - 2, y - 2, 1 + (cnt * (6 + 1)) + 2, 10 + 2); - for (int i = (cnt -1) *4; i >= 0; i -= 4, x += 6+1) - show(canvas, x,y, img_6x8[(val >>i) &0xF], SHOW_SET_WHT) ; + for(int i = (cnt - 1) * 4; i >= 0; i -= 4, x += 6 + 1) + show(canvas, x, y, img_6x8[(val >> i) & 0xF], SHOW_SET_WHT); } //============================================================================= ======================================== // Show the up/down "peak hold" controls in the bottom right // -void showPeakHold (state_t* const state, Canvas* const canvas, const int hold) -{ - switch (hold) { - case 0: - show(canvas, 119,51, &img_key_U, SHOW_CLR_BLK); - show(canvas, 119,56, &img_key_D, SHOW_CLR_BLK); - break; - case +1: - canvas_set_color(canvas, ColorBlack); - canvas_draw_box(canvas, 120,52, 7,6); - show(canvas, 119,51, &img_key_U, SHOW_CLR_WHT); - show(canvas, 119,56, &img_key_D, SHOW_CLR_BLK); - break; - case -1: - show(canvas, 119,51, &img_key_U, SHOW_CLR_BLK); - canvas_draw_box(canvas, 120,57, 7,6); - show(canvas, 119,56, &img_key_D, SHOW_CLR_WHT); - break; - default: - break; - } - canvas_set_color(canvas, ColorBlack); - canvas_draw_frame(canvas, 119,51, 9,13); +void showPeakHold(state_t* const state, Canvas* const canvas, const int hold) { + switch(hold) { + case 0: + show(canvas, 119, 51, &img_key_U, SHOW_CLR_BLK); + show(canvas, 119, 56, &img_key_D, SHOW_CLR_BLK); + break; + case +1: + canvas_set_color(canvas, ColorBlack); + canvas_draw_box(canvas, 120, 52, 7, 6); + show(canvas, 119, 51, &img_key_U, SHOW_CLR_WHT); + show(canvas, 119, 56, &img_key_D, SHOW_CLR_BLK); + break; + case -1: + show(canvas, 119, 51, &img_key_U, SHOW_CLR_BLK); + canvas_draw_box(canvas, 120, 57, 7, 6); + show(canvas, 119, 56, &img_key_D, SHOW_CLR_WHT); + break; + default: + break; + } + canvas_set_color(canvas, ColorBlack); + canvas_draw_frame(canvas, 119, 51, 9, 13); - // calibration indicator - show( canvas, 108,55, - ((state->calib & CAL_RANGE) && (++state->flash &8)) ? &img_key_OKi : &img_key_OK, - SHOW_SET_BLK ); + // calibration indicator + show( + canvas, + 108, + 55, + ((state->calib & CAL_RANGE) && (++state->flash & 8)) ? &img_key_OKi : &img_key_OK, + SHOW_SET_BLK); } //============================================================================= ======================================== -// This code performs a FULL calibration on the device EVERY time it draws a joystick +// This code performs a FULL calibration on the device EVERY time it draws a joystick //...This is NOT a good way forward for anything other than a test tool. // // Realistically you would do all the maths when the controller is connected -// or, if you prefer (and it IS a good thing), have a "calibrate controller" menu option +// or, if you prefer (and it IS a good thing), have a "calibrate controller" menu option // ...and then just use a lookup table, or trivial formual // // THIS algorithm chops the joystick in to one of 9 zones @@ -97,12 +130,12 @@ void showPeakHold (state_t* const state, Canvas* const canvas, const int hold // FullLeft and FullRight have a deadzone of N [qv. xDead] ..a total of N+1 positions // Middle has a deadzone of N EACH WAY ...a total of 2N+1 positions // -// If the remaining range does not divide evenly in to three zones, +// If the remaining range does not divide evenly in to three zones, // the first remainder is added to zone3, // and the second remainder (if there is one) is added to zone2 // ...giving finer control near the centre of the joystick // -// The value of the deadzone is based on the number of bits in the +// The value of the deadzone is based on the number of bits in the // joystcik {x,y} values - the larger the range, the larger the deadzone. // // 03 15 29 @@ -118,106 +151,132 @@ void showPeakHold (state_t* const state, Canvas* const canvas, const int hold // Turn and object - this is probably good enough // Start slowly & pick up speed - how about a log or sine curve? // -void showJoy ( Canvas* const canvas, const uint8_t x, const uint8_t y, // x,y is the CENTRE of the Joystick - const uint8_t xMin, const uint8_t xMid, const uint8_t xMax, - const uint8_t yMin, const uint8_t yMid, const uint8_t yMax, - const uint8_t xPos, const uint8_t yPos, const uint8_t bits ) -{ - int xOff = 0; // final offset of joystick hat image - int yOff = 0; +void showJoy( + Canvas* const canvas, + const uint8_t x, + const uint8_t y, // x,y is the CENTRE of the Joystick + const uint8_t xMin, + const uint8_t xMid, + const uint8_t xMax, + const uint8_t yMin, + const uint8_t yMid, + const uint8_t yMax, + const uint8_t xPos, + const uint8_t yPos, + const uint8_t bits) { + int xOff = 0; // final offset of joystick hat image + int yOff = 0; - int xDead = (bits < 7) ? (1<<0) : (1<<3); // dead zone (centre & limits) - int yDead = xDead; + int xDead = (bits < 7) ? (1 << 0) : (1 << 3); // dead zone (centre & limits) + int yDead = xDead; - // This code is NOT optimised ...and it's still barely readable! - if ((xPos >= (xMid -xDead)) && (xPos <= (xMid +xDead))) xOff = 0 ; // centre [most likely] - else if (xPos <= (xMin +xDead)) xOff = -4 ; // full left - else if (xPos >= (xMax -xDead)) xOff = +4 ; // full right - else if (xPos < (xMid -xDead)) { // part left - // very much hard-coded for 3 interim positions - int lo = (xMin +xDead) +1; // lowest position - int hi = (xMid -xDead) -1; // highest position + // This code is NOT optimised ...and it's still barely readable! + if((xPos >= (xMid - xDead)) && (xPos <= (xMid + xDead))) + xOff = 0; // centre [most likely] + else if(xPos <= (xMin + xDead)) + xOff = -4; // full left + else if(xPos >= (xMax - xDead)) + xOff = +4; // full right + else if(xPos < (xMid - xDead)) { // part left + // very much hard-coded for 3 interim positions + int lo = (xMin + xDead) + 1; // lowest position + int hi = (xMid - xDead) - 1; // highest position - // this is the only duplicated bit of code - int range = (hi -lo) +1; // range covered - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) + // this is the only duplicated bit of code + int range = (hi - lo) + 1; // range covered + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) -// int hi1 = hi; // lowest value for zone #-1 -// int lo1 = hi1 -div +1; // highest value for zone #-1 -// int hi2 = lo1 -1; // lowest value for zone #-2 -// int lo2 = hi2 -div +1 -(rem==2); // highest value for zone #-2 expand out remainder -// int hi3 = lo2 -1; // lowest value for zone #-3 -// int lo3 = hi3 -div +1 -(rem>=1); // highest value for zone #-3 expand out remainder + // int hi1 = hi; // lowest value for zone #-1 + // int lo1 = hi1 -div +1; // highest value for zone #-1 + // int hi2 = lo1 -1; // lowest value for zone #-2 + // int lo2 = hi2 -div +1 -(rem==2); // highest value for zone #-2 expand out remainder + // int hi3 = lo2 -1; // lowest value for zone #-3 + // int lo3 = hi3 -div +1 -(rem>=1); // highest value for zone #-3 expand out remainder - int lo1 = hi -div +1; // (in brevity) - int hi3 = hi -div -div -(rem==2); // ... + int lo1 = hi - div + 1; // (in brevity) + int hi3 = hi - div - div - (rem == 2); // ... - if (xPos <= hi3) xOff = -3 ; // zone #-3 - else if (xPos >= lo1) xOff = -1 ; // zone #-1 - else xOff = -2 ; // zone #-2 + if(xPos <= hi3) + xOff = -3; // zone #-3 + else if(xPos >= lo1) + xOff = -1; // zone #-1 + else + xOff = -2; // zone #-2 - } else /*if (xPos > (xMid +xDead))*/ { // part right - // very much hard-coded for 3 interim positions - int lo = (xMid +xDead) +1; // lowest position - int hi = (xMax -xDead) -1; // highest position + } else /*if (xPos > (xMid +xDead))*/ { // part right + // very much hard-coded for 3 interim positions + int lo = (xMid + xDead) + 1; // lowest position + int hi = (xMax - xDead) - 1; // highest position - int range = (hi -lo) +1; // range covered - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) + int range = (hi - lo) + 1; // range covered + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) -// int lo1 = lo; // lowest value for zone #+1 -// int hi1 = lo +div -1; // highest value for zone #+1 -// int lo2 = hi1 +1; // lowest value for zone #+2 -// int hi2 = lo2 +div -1 +(rem==2); // highest value for zone #+2 expand out remainder -// int lo3 = hi2 +1; // lowest value for zone #+3 -// int hi3 = lo3 +div -1 +(rem>=1); // highest value for zone #+3 expand out remainder + // int lo1 = lo; // lowest value for zone #+1 + // int hi1 = lo +div -1; // highest value for zone #+1 + // int lo2 = hi1 +1; // lowest value for zone #+2 + // int hi2 = lo2 +div -1 +(rem==2); // highest value for zone #+2 expand out remainder + // int lo3 = hi2 +1; // lowest value for zone #+3 + // int hi3 = lo3 +div -1 +(rem>=1); // highest value for zone #+3 expand out remainder - int hi1 = lo +div -1; // (in brevity) - int lo3 = lo +div +div +(rem==2); // ... + int hi1 = lo + div - 1; // (in brevity) + int lo3 = lo + div + div + (rem == 2); // ... - if (xPos <= hi1) xOff = 1 ; // zone #1 - else if (xPos >= lo3) xOff = 3 ; // zone #3 - else xOff = 2 ; // zone #2 - } + if(xPos <= hi1) + xOff = 1; // zone #1 + else if(xPos >= lo3) + xOff = 3; // zone #3 + else + xOff = 2; // zone #2 + } - // All this to print a 3x3 square (in the right place) - LOL! - if ((yPos >= (yMid -yDead)) && (yPos <= (yMid +yDead))) yOff = 0 ; // centre [most likely] - else if (yPos <= (yMin +yDead)) yOff = +4 ; // full down - else if (yPos >= (yMax -yDead)) yOff = -4 ; // full up - else if (yPos < (yMid -yDead)) { // part down - int lo = (yMin +yDead) +1; // lowest position - int hi = (yMid -yDead) -1; // highest position + // All this to print a 3x3 square (in the right place) - LOL! + if((yPos >= (yMid - yDead)) && (yPos <= (yMid + yDead))) + yOff = 0; // centre [most likely] + else if(yPos <= (yMin + yDead)) + yOff = +4; // full down + else if(yPos >= (yMax - yDead)) + yOff = -4; // full up + else if(yPos < (yMid - yDead)) { // part down + int lo = (yMin + yDead) + 1; // lowest position + int hi = (yMid - yDead) - 1; // highest position - int range = (hi -lo) +1; // range covered - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) + int range = (hi - lo) + 1; // range covered + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) - int lo1 = hi -div +1; // (in brevity) - int hi3 = hi -div -div -(rem==2); // ... + int lo1 = hi - div + 1; // (in brevity) + int hi3 = hi - div - div - (rem == 2); // ... - if (yPos <= hi3) yOff = +3 ; // zone #3 - else if (yPos >= lo1) yOff = +1 ; // zone #1 - else yOff = +2 ; // zone #2 + if(yPos <= hi3) + yOff = +3; // zone #3 + else if(yPos >= lo1) + yOff = +1; // zone #1 + else + yOff = +2; // zone #2 - } else /*if (yPos > (yMid +yDead))*/ { // part up - int lo = (yMid +yDead) +1; // lowest position - int hi = (yMax -yDead) -1; // highest position + } else /*if (yPos > (yMid +yDead))*/ { // part up + int lo = (yMid + yDead) + 1; // lowest position + int hi = (yMax - yDead) - 1; // highest position - int range = (hi -lo) +1; // range covered - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) + int range = (hi - lo) + 1; // range covered + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) - int hi1 = lo +div -1; // (in brevity) - int lo3 = lo +div +div +(rem==2); // ... + int hi1 = lo + div - 1; // (in brevity) + int lo3 = lo + div + div + (rem == 2); // ... - if (yPos <= hi1) yOff = -1 ; // zone #-1 - else if (yPos >= lo3) yOff = -3 ; // zone #-3 - else yOff = -2 ; // zone #-2 - } + if(yPos <= hi1) + yOff = -1; // zone #-1 + else if(yPos >= lo3) + yOff = -3; // zone #-3 + else + yOff = -2; // zone #-2 + } - show(canvas, x-(img_cc_Joy.w/2),y-(img_cc_Joy.h/2), &img_cc_Joy, SHOW_SET_BLK); + show(canvas, x - (img_cc_Joy.w / 2), y - (img_cc_Joy.h / 2), &img_cc_Joy, SHOW_SET_BLK); - // All ^that^ for v-this-v - LOL!! - canvas_draw_box(canvas, (x-1)+xOff,(y-1)+yOff, 3,3); + // All ^that^ for v-this-v - LOL!! + canvas_draw_box(canvas, (x - 1) + xOff, (y - 1) + yOff, 3, 3); } diff --git a/applications/plugins/wii_ec_anal/wii_anal_lcd.h b/applications/plugins/wii_ec_anal/wii_anal_lcd.h index 5258c4de1..e52a3adc6 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_lcd.h +++ b/applications/plugins/wii_ec_anal/wii_anal_lcd.h @@ -1,43 +1,57 @@ -#ifndef WII_ANAL_LCD_H_ -#define WII_ANAL_LCD_H_ +#ifndef WII_ANAL_LCD_H_ +#define WII_ANAL_LCD_H_ //----------------------------------------------------------------------------- ---------------------------------------- // A couple of monospaced hex fonts // #include "gfx/images.h" -extern const image_t* img_6x8[]; -extern const image_t* img_5x7[]; +extern const image_t* img_6x8[]; +extern const image_t* img_5x7[]; //============================================================================= ======================================== // macros to draw only two sides of a box // these are used for drawing the wires on the WAIT screen // -#define BOX_TL(x1,y1,x2,y2) do { \ - canvas_draw_frame(canvas, x1,y1, x2-x1+1,2); \ - canvas_draw_frame(canvas, x1,y1+2, 2,y2-y1+1-2); \ -}while(0) - -#define BOX_BL(x1,y1,x2,y2) do { \ - canvas_draw_frame(canvas, x1,y2-1, x2-x1+1,2); \ - canvas_draw_frame(canvas, x1,y1, 2,y2-y1+1-2); \ -}while(0) +#define BOX_TL(x1, y1, x2, y2) \ + do { \ + canvas_draw_frame(canvas, x1, y1, x2 - x1 + 1, 2); \ + canvas_draw_frame(canvas, x1, y1 + 2, 2, y2 - y1 + 1 - 2); \ + } while(0) +#define BOX_BL(x1, y1, x2, y2) \ + do { \ + canvas_draw_frame(canvas, x1, y2 - 1, x2 - x1 + 1, 2); \ + canvas_draw_frame(canvas, x1, y1, 2, y2 - y1 + 1 - 2); \ + } while(0) //============================================================================= ======================================== // Function prototypes // -void patBacklight (state_t* state) ; +void patBacklight(state_t* state); -void showHex ( Canvas* const canvas, uint8_t x, uint8_t y, - const uint32_t val, const uint8_t cnt, const int b ) ; +void showHex( + Canvas* const canvas, + uint8_t x, + uint8_t y, + const uint32_t val, + const uint8_t cnt, + const int b); -void showPeakHold (state_t* const state, Canvas* const canvas, const int hold) ; - -void showJoy ( Canvas* const canvas, const uint8_t x, const uint8_t y, // x,y is the CENTRE of the Joystick - const uint8_t xMin, const uint8_t xMid, const uint8_t xMax, - const uint8_t yMin, const uint8_t yMid, const uint8_t yMax, - const uint8_t xPos, const uint8_t yPos, const uint8_t bits ) ; +void showPeakHold(state_t* const state, Canvas* const canvas, const int hold); +void showJoy( + Canvas* const canvas, + const uint8_t x, + const uint8_t y, // x,y is the CENTRE of the Joystick + const uint8_t xMin, + const uint8_t xMid, + const uint8_t xMax, + const uint8_t yMin, + const uint8_t yMid, + const uint8_t yMax, + const uint8_t xPos, + const uint8_t yPos, + const uint8_t bits); #endif //WII_ANAL_LCD_H_ diff --git a/applications/plugins/wii_ec_anal/wii_anal_ver.h b/applications/plugins/wii_ec_anal/wii_anal_ver.h index 88ed17d19..3f2c8c0e6 100644 --- a/applications/plugins/wii_ec_anal/wii_anal_ver.h +++ b/applications/plugins/wii_ec_anal/wii_anal_ver.h @@ -1,9 +1,9 @@ -#ifndef WII_ANAL_VER_H_ -#define WII_ANAL_VER_H_ +#ifndef WII_ANAL_VER_H_ +#define WII_ANAL_VER_H_ -#include "gfx/images.h" +#include "gfx/images.h" -#define VER_MAJ &img_3x5_1 -#define VER_MIN &img_3x5_0 +#define VER_MAJ &img_3x5_1 +#define VER_MIN &img_3x5_0 #endif //WII_ANAL_VER_H_ diff --git a/applications/plugins/wii_ec_anal/wii_ec.c b/applications/plugins/wii_ec_anal/wii_ec.c index 87b4edcfb..7a8aabeb5 100644 --- a/applications/plugins/wii_ec_anal/wii_ec.c +++ b/applications/plugins/wii_ec_anal/wii_ec.c @@ -1,214 +1,276 @@ -#include -#include // Core API +#include +#include // Core API -#include "wii_anal.h" -#include "wii_i2c.h" -#include "wii_ec.h" -#include "bc_logging.h" +#include "wii_anal.h" +#include "wii_i2c.h" +#include "wii_ec.h" +#include "bc_logging.h" -#include "gfx/images.h" // Images -#include "wii_anal_lcd.h" // Drawing functions -#include "wii_anal_keys.h" // key mappings +#include "gfx/images.h" // Images +#include "wii_anal_lcd.h" // Drawing functions +#include "wii_anal_keys.h" // key mappings //----------------------------------------------------------------------------- ---------------------------------------- // List of known perhipherals // // More perhipheral ID codes here: https://wiibrew.org/wiki/Wiimote/Extension_Controllers#The_New_Way // -const ecId_t ecId[PID_CNT] = { - [PID_UNKNOWN ] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, "Unknown Perhipheral", SCENE_DUMP, - NULL, NULL, NULL, NULL, ec_show, ec_key}, +const ecId_t ecId[PID_CNT] = { + [PID_UNKNOWN] = + {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + "Unknown Perhipheral", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + ec_show, + ec_key}, - // If you're wise, ONLY edit this bit - [PID_NUNCHUCK ] = { {0x00, 0x00, 0xA4, 0x20, 0x00, 0x00}, "Nunchuck", SCENE_NUNCHUCK, - NULL, nunchuck_decode, nunchuck_msg, nunchuck_calib, nunchuck_show, nunchuck_key }, + // If you're wise, ONLY edit this bit + [PID_NUNCHUCK] = + {{0x00, 0x00, 0xA4, 0x20, 0x00, 0x00}, + "Nunchuck", + SCENE_NUNCHUCK, + NULL, + nunchuck_decode, + nunchuck_msg, + nunchuck_calib, + nunchuck_show, + nunchuck_key}, - [PID_CLASSIC ] = { {0x00, 0x00, 0xA4, 0x20, 0x01, 0x01}, "Classic Controller", SCENE_CLASSIC, - NULL, classic_decode, classic_msg, classic_calib, classic_show, classic_key }, + [PID_CLASSIC] = + {{0x00, 0x00, 0xA4, 0x20, 0x01, 0x01}, + "Classic Controller", + SCENE_CLASSIC, + NULL, + classic_decode, + classic_msg, + classic_calib, + classic_show, + classic_key}, - [PID_BALANCE ] = { {0x00, 0x00, 0xA4, 0x20, 0x04, 0x02}, "Balance Board", SCENE_DUMP, - NULL, NULL, NULL, NULL, NULL, NULL }, + [PID_BALANCE] = + {{0x00, 0x00, 0xA4, 0x20, 0x04, 0x02}, + "Balance Board", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, - [PID_GH_GUITAR ] = { {0x00, 0x00, 0xA4, 0x20, 0x01, 0x03}, "Guitar Hero Guitar", SCENE_DUMP, - NULL, NULL, NULL, NULL, NULL, NULL }, + [PID_GH_GUITAR] = + {{0x00, 0x00, 0xA4, 0x20, 0x01, 0x03}, + "Guitar Hero Guitar", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, - [PID_GH_DRUMS ] = { {0x01, 0x00, 0xA4, 0x20, 0x01, 0x03}, "Guitar Hero World Tour Drums", SCENE_DUMP, - NULL, NULL, NULL, NULL, NULL, NULL }, + [PID_GH_DRUMS] = + {{0x01, 0x00, 0xA4, 0x20, 0x01, 0x03}, + "Guitar Hero World Tour Drums", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, - [PID_TURNTABLE ] = { {0x03, 0x00, 0xA4, 0x20, 0x01, 0x03}, "DJ Hero Turntable", SCENE_DUMP, - NULL, NULL, NULL, NULL, NULL, NULL }, + [PID_TURNTABLE] = + {{0x03, 0x00, 0xA4, 0x20, 0x01, 0x03}, + "DJ Hero Turntable", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, - [PID_TAIKO_DRUMS] = { {0x00, 0x00, 0xA4, 0x20, 0x01, 0x11}, "Taiko Drum Controller)", SCENE_DUMP, - NULL, NULL, NULL, NULL, NULL, NULL }, // Taiko no Tatsujin TaTaCon (Drum controller) + [PID_TAIKO_DRUMS] = + {{0x00, 0x00, 0xA4, 0x20, 0x01, 0x11}, + "Taiko Drum Controller)", + SCENE_DUMP, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, // Taiko no Tatsujin TaTaCon (Drum controller) - [PID_UDRAW ] = { {0xFF, 0x00, 0xA4, 0x20, 0x00, 0x13}, "uDraw Tablet", SCENE_DUMP, - udraw_init, NULL, NULL, NULL, NULL, NULL }, //! same as drawsome? - // ----- + [PID_UDRAW] = + {{0xFF, 0x00, 0xA4, 0x20, 0x00, 0x13}, + "uDraw Tablet", + SCENE_DUMP, + udraw_init, + NULL, + NULL, + NULL, + NULL, + NULL}, //! same as drawsome? + // ----- - [PID_ERROR ] = { {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, "Read Error", SCENE_NONE, - NULL, NULL, NULL, NULL, NULL, NULL }, + [PID_ERROR] = + {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + "Read Error", + SCENE_NONE, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, - [PID_NULL ] = { {0}, NULL, SCENE_NONE, NULL, NULL, NULL, NULL, NULL, NULL } // last entry + [PID_NULL] = {{0}, NULL, SCENE_NONE, NULL, NULL, NULL, NULL, NULL, NULL} // last entry }; //+============================================================================ ======================================== -void ecDecode (wiiEC_t* pec) -{ - if (ecId[pec->pidx].decode) ecId[pec->pidx].decode(pec) ; +void ecDecode(wiiEC_t* pec) { + if(ecId[pec->pidx].decode) ecId[pec->pidx].decode(pec); } //+============================================================================ ======================================== -void ecCalibrate (wiiEC_t* const pec, ecCalib_t c) -{ - if (ecId[pec->pidx].calib) ecId[pec->pidx].calib(pec, c) ; +void ecCalibrate(wiiEC_t* const pec, ecCalib_t c) { + if(ecId[pec->pidx].calib) ecId[pec->pidx].calib(pec, c); } //+============================================================================ ======================================== -void ecPoll (wiiEC_t* const pec, FuriMessageQueue* const queue) -{ - ENTER; - furi_assert(queue); +void ecPoll(wiiEC_t* const pec, FuriMessageQueue* const queue) { + ENTER; + furi_assert(queue); - if (!pec->init) { - // Attempt to initialise - if (ecInit(pec, NULL)) { //! need a way to auto-start with encryption enabled - eventMsg_t msg = { - .id = EVID_WIIEC, - .wiiEc = { - .type = WIIEC_CONN, - .in = '<', - .val = pec->pidx - } - }; - furi_message_queue_put(queue, &msg, 0); - } + if(!pec->init) { + // Attempt to initialise + if(ecInit(pec, NULL)) { //! need a way to auto-start with encryption enabled + eventMsg_t msg = { + .id = EVID_WIIEC, .wiiEc = {.type = WIIEC_CONN, .in = '<', .val = pec->pidx}}; + furi_message_queue_put(queue, &msg, 0); + } - } else { - // Attempt to read - switch (ecRead(pec)) { - case 2: { // device gone - eventMsg_t msg = { - .id = EVID_WIIEC, - .wiiEc = { - .type = WIIEC_DISCONN, - .in = '>', - .val = pec->pidx - } - }; - furi_message_queue_put(queue, &msg, 0); - break; - } + } else { + // Attempt to read + switch(ecRead(pec)) { + case 2: { // device gone + eventMsg_t msg = { + .id = EVID_WIIEC, .wiiEc = {.type = WIIEC_DISCONN, .in = '>', .val = pec->pidx}}; + furi_message_queue_put(queue, &msg, 0); + break; + } - case 0: { // read OK - void (*fn)(wiiEC_t*, FuriMessageQueue*) = ecId[pec->pidx].check; - if (fn) fn(pec, queue); - break; - } + case 0: { // read OK + void (*fn)(wiiEC_t*, FuriMessageQueue*) = ecId[pec->pidx].check; + if(fn) fn(pec, queue); + break; + } - case 3: // read fail - // this is probably temporary just ignore it - break; + case 3: // read fail + // this is probably temporary just ignore it + break; - default: // bug: unknown - case 1: // bug: not initialised - should never happen - ERROR("%s : read bug", __func__); - break; - } - } + default: // bug: unknown + case 1: // bug: not initialised - should never happen + ERROR("%s : read bug", __func__); + break; + } + } - LEAVE; - return; + LEAVE; + return; } //+============================================================================ ======================================== // This is the screen drawn for an unknown controller // It is also available by pressing LEFT (at least once) on a "known controller" screen // -void ec_show (Canvas* const canvas, state_t* const state) -{ - wiiEC_t* pec = &state->ec; - int h = 11; // line height - int x = 1; // (initial) offset for bits - int y = -h; // previous y value - int yb = 0; // y for bit patterns - int c2 = 17; // column 2 +void ec_show(Canvas* const canvas, state_t* const state) { + wiiEC_t* pec = &state->ec; + int h = 11; // line height + int x = 1; // (initial) offset for bits + int y = -h; // previous y value + int yb = 0; // y for bit patterns + int c2 = 17; // column 2 - // Headings - canvas_set_font(canvas, FontSecondary); - canvas_set_color(canvas, ColorBlack); + // Headings + canvas_set_font(canvas, FontSecondary); + canvas_set_color(canvas, ColorBlack); - canvas_draw_str_aligned(canvas, 0 ,0, AlignLeft, AlignTop, "SID:"); - canvas_draw_str_aligned(canvas, c2,0, AlignLeft, AlignTop, pec->sid); + canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, "SID:"); + canvas_draw_str_aligned(canvas, c2, 0, AlignLeft, AlignTop, pec->sid); - canvas_draw_str_aligned(canvas, 0 ,11, AlignLeft, AlignTop, "PID:"); - canvas_draw_str_aligned(canvas, 0 ,22, AlignLeft, AlignTop, "Cal:"); + canvas_draw_str_aligned(canvas, 0, 11, AlignLeft, AlignTop, "PID:"); + canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignTop, "Cal:"); - // PID - x = c2; - for (int i = 0; i < 6; i++) { - show(canvas, x,11, img_5x7[pec->pid[i]>>4], SHOW_SET_BLK); - x += 5+1; - show(canvas, x,11, img_5x7[pec->pid[i]&0xF], SHOW_SET_BLK); - x += 5+1+2; - } + // PID + x = c2; + for(int i = 0; i < 6; i++) { + show(canvas, x, 11, img_5x7[pec->pid[i] >> 4], SHOW_SET_BLK); + x += 5 + 1; + show(canvas, x, 11, img_5x7[pec->pid[i] & 0xF], SHOW_SET_BLK); + x += 5 + 1 + 2; + } - // Calibrations data - y = 11; - for (int j = 0; j <= 8; j += 8) { - x = c2; - y += 11; - for (int i = 0; i < 8; i++) { - show(canvas, x,y, img_5x7[pec->calF[i+j]>>4], SHOW_SET_BLK); - x += 5+1; - show(canvas, x,y, img_5x7[pec->calF[i+j]&0xF], SHOW_SET_BLK); - x += 5+1+2; - } - } + // Calibrations data + y = 11; + for(int j = 0; j <= 8; j += 8) { + x = c2; + y += 11; + for(int i = 0; i < 8; i++) { + show(canvas, x, y, img_5x7[pec->calF[i + j] >> 4], SHOW_SET_BLK); + x += 5 + 1; + show(canvas, x, y, img_5x7[pec->calF[i + j] & 0xF], SHOW_SET_BLK); + x += 5 + 1 + 2; + } + } - // Reading - x = 1; - y++; - yb = (y+=h) +h +2; + // Reading + x = 1; + y++; + yb = (y += h) + h + 2; - canvas_draw_line(canvas, x,y-1, x,yb+4); - x += 2; + canvas_draw_line(canvas, x, y - 1, x, yb + 4); + x += 2; - for (int i = 0; i < JOY_LEN; i++) { - show(canvas, x+ 1,y, img_6x8[pec->joy[i]>>4], SHOW_SET_BLK); - show(canvas, x+11,y, img_6x8[pec->joy[i]&0xF], SHOW_SET_BLK); + for(int i = 0; i < JOY_LEN; i++) { + show(canvas, x + 1, y, img_6x8[pec->joy[i] >> 4], SHOW_SET_BLK); + show(canvas, x + 11, y, img_6x8[pec->joy[i] & 0xF], SHOW_SET_BLK); - // bits - for (int m = 0x80; m; m >>= 1) { - x += 2 * !!(m & 0x08) ; // nybble step - canvas_draw_box(canvas, x,yb +(2*!(pec->joy[i] & m)), 2,2) ; - x += 2; // bit step - } + // bits + for(int m = 0x80; m; m >>= 1) { + x += 2 * !!(m & 0x08); // nybble step + canvas_draw_box(canvas, x, yb + (2 * !(pec->joy[i] & m)), 2, 2); + x += 2; // bit step + } - // byte step - x += 1; - canvas_draw_line(canvas, x,y-1, x,yb+4); - x += 2; - } + // byte step + x += 1; + canvas_draw_line(canvas, x, y - 1, x, yb + 4); + x += 2; + } - // Scene navigation - if (state->scenePrev != SCENE_WAIT) - show(canvas, 120,0, &img_key_R, SHOW_SET_BLK); + // Scene navigation + if(state->scenePrev != SCENE_WAIT) show(canvas, 120, 0, &img_key_R, SHOW_SET_BLK); } //+============================================================================ ======================================== -// The DUMP screen is +// The DUMP screen is // -bool ec_key (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +bool ec_key(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - if (state->scenePrev != SCENE_WAIT) { - //# input.type == InputTypeShort) && (msg->input.key == InputKeyRight)) { - sceneSet(state, state->scenePrev); - used = true; - } - } + if(state->scenePrev != SCENE_WAIT) { + //# input.type == InputTypeShort) && (msg->input.key == InputKeyRight)) { + sceneSet(state, state->scenePrev); + used = true; + } + } - return used; + return used; } diff --git a/applications/plugins/wii_ec_anal/wii_ec.h b/applications/plugins/wii_ec_anal/wii_ec.h index 60f7c7b23..048c0af70 100644 --- a/applications/plugins/wii_ec_anal/wii_ec.h +++ b/applications/plugins/wii_ec_anal/wii_ec.h @@ -1,156 +1,140 @@ -#ifndef WII_EC_H_ -#define WII_EC_H_ +#ifndef WII_EC_H_ +#define WII_EC_H_ -#include +#include -#include +#include -#include "wii_ec_nunchuck.h" -#include "wii_ec_classic.h" -#include "wii_ec_udraw.h" +#include "wii_ec_nunchuck.h" +#include "wii_ec_classic.h" +#include "wii_ec_udraw.h" //----------------------------------------------------------------------------- ---------------------------------------- // Crypto key (PSK), base register : {0x40..0x4F}[2][8] -#define ENC_LEN (2*8) +#define ENC_LEN (2 * 8) // Controller State data, base register : {0x00..0x05}[6] -#define JOY_LEN (6) +#define JOY_LEN (6) // Calibration data, base register : {0x20..0x2F}[16] -#define CAL_LEN (16) +#define CAL_LEN (16) // Controller ID, base register : {0xFA..0xFF}[6] -#define PID_LEN (6) +#define PID_LEN (6) //----------------------------------------------------------------------------- ---------------------------------------- // Perhipheral specific parameters union // -typedef - union ecDec { - ecDecNunchuck_t nunchuck; - ecDecClassic_t classic; - } -ecDec_t; +typedef union ecDec { + ecDecNunchuck_t nunchuck; + ecDecClassic_t classic; +} ecDec_t; //----------------------------------------------------------------------------- -typedef - union ecCal { - // 0=lowest seen ; 1=min ; 2=mid ; 3=max ; 4=highest seen - ecCalNunchuck_t nunchuck[5]; - ecCalClassic_t classic[5]; - } -ecCal_t; +typedef union ecCal { + // 0=lowest seen ; 1=min ; 2=mid ; 3=max ; 4=highest seen + ecCalNunchuck_t nunchuck[5]; + ecCalClassic_t classic[5]; +} ecCal_t; //----------------------------------------------------------------------------- ---------------------------------------- // Wii Extension Controller events // -typedef - enum wiiEcEventType { - WIIEC_NONE, - WIIEC_CONN, // Connect - WIIEC_DISCONN, // Disconnect - WIIEC_PRESS, // Press button - WIIEC_RELEASE, // Release button - WIIEC_ANALOG, // Analogue change (Joystick/Trigger) - WIIEC_ACCEL, // Accelerometer change - } -wiiEcEventType_t; +typedef enum wiiEcEventType { + WIIEC_NONE, + WIIEC_CONN, // Connect + WIIEC_DISCONN, // Disconnect + WIIEC_PRESS, // Press button + WIIEC_RELEASE, // Release button + WIIEC_ANALOG, // Analogue change (Joystick/Trigger) + WIIEC_ACCEL, // Accelerometer change +} wiiEcEventType_t; //----------------------------------------------------------------------------- -typedef - struct wiiEcEvent { - wiiEcEventType_t type; // event type - char in; // input (see device specific options) - uint32_t val; // new value - meaningless for digital button presses - } -wiiEcEvent_t; +typedef struct wiiEcEvent { + wiiEcEventType_t type; // event type + char in; // input (see device specific options) + uint32_t val; // new value - meaningless for digital button presses +} wiiEcEvent_t; //----------------------------------------------------------------------------- ---------------------------------------- // Known perhipheral types // -typedef - enum ecPid { - PID_UNKNOWN = 0, - PID_FIRST = 1, - PID_NUNCHUCK = PID_FIRST, +typedef enum ecPid { + PID_UNKNOWN = 0, + PID_FIRST = 1, + PID_NUNCHUCK = PID_FIRST, - // If you're wise, ONLY edit this section - PID_CLASSIC, - PID_BALANCE, - PID_GH_GUITAR, - PID_GH_DRUMS, - PID_TURNTABLE, - PID_TAIKO_DRUMS, - PID_UDRAW, //! same as drawsome? - // ----- + // If you're wise, ONLY edit this section + PID_CLASSIC, + PID_BALANCE, + PID_GH_GUITAR, + PID_GH_DRUMS, + PID_TURNTABLE, + PID_TAIKO_DRUMS, + PID_UDRAW, //! same as drawsome? + // ----- - PID_ERROR, - PID_NULL, - PID_CNT, - } -ecPid_t; + PID_ERROR, + PID_NULL, + PID_CNT, +} ecPid_t; //----------------------------------------------------------------------------- // Calibration strategies // -typedef - enum ecCalib { - CAL_FACTORY = 0x01, // (re)set to factory defaults - CAL_TRACK = 0x02, // track maximum and minimum values seen - CAL_RESET = 0x04, // initialise ready for software calibration - CAL_RANGE = 0x08, // perform software calibration step - CAL_CENTRE = 0x10, // reset centre point of joystick - CAL_NOTJOY = 0x20, // do NOT calibrate the joystick - } -ecCalib_t; +typedef enum ecCalib { + CAL_FACTORY = 0x01, // (re)set to factory defaults + CAL_TRACK = 0x02, // track maximum and minimum values seen + CAL_RESET = 0x04, // initialise ready for software calibration + CAL_RANGE = 0x08, // perform software calibration step + CAL_CENTRE = 0x10, // reset centre point of joystick + CAL_NOTJOY = 0x20, // do NOT calibrate the joystick +} ecCalib_t; //----------------------------------------------------------------------------- // ecId table entry // -typedef - struct ecId { - uint8_t id[6]; // 6 byte ID string returned by Extension Controller - char* name; // Friendly name - scene_t scene; // Default scene - bool (*init)(wiiEC_t*); // Additional initialisation code - void (*decode)(wiiEC_t*); // Decode function - void (*check)(wiiEC_t*, FuriMessageQueue*); // check (for action) function - void (*calib)(wiiEC_t*, ecCalib_t); // calibrate analogue controllers [SOFTWARE] - void (*show)(Canvas* const, state_t* const); // Draw scene - bool (*keys)(const eventMsg_t* const, state_t* const); // Interpret keys - } -ecId_t; +typedef struct ecId { + uint8_t id[6]; // 6 byte ID string returned by Extension Controller + char* name; // Friendly name + scene_t scene; // Default scene + bool (*init)(wiiEC_t*); // Additional initialisation code + void (*decode)(wiiEC_t*); // Decode function + void (*check)(wiiEC_t*, FuriMessageQueue*); // check (for action) function + void (*calib)(wiiEC_t*, ecCalib_t); // calibrate analogue controllers [SOFTWARE] + void (*show)(Canvas* const, state_t* const); // Draw scene + bool (*keys)(const eventMsg_t* const, state_t* const); // Interpret keys +} ecId_t; //----------------------------------------------------------------------------- // List of known perhipherals // // More perhipheral ID codes here: https://wiibrew.org/wiki/Wiimote/Extension_Controllers#The_New_Way // -extern const ecId_t ecId[PID_CNT] ; +extern const ecId_t ecId[PID_CNT]; //----------------------------------------------------------------------------- ---------------------------------------- // Data pertaining to a single Perhipheral instance // -typedef - struct wiiEC { - // Perhipheral state - bool init; // Initialised? +typedef struct wiiEC { + // Perhipheral state + bool init; // Initialised? - uint8_t pid[PID_LEN]; // PID string - eg. {0x00, 0x00, 0xA4, 0x20, 0x00, 0x00} - ecPid_t pidx; // Index in to ecId table - const char* sid; // just for convenience + uint8_t pid[PID_LEN]; // PID string - eg. {0x00, 0x00, 0xA4, 0x20, 0x00, 0x00} + ecPid_t pidx; // Index in to ecId table + const char* sid; // just for convenience - bool encrypt; // encryption enabled? - uint8_t encKey[ENC_LEN]; // encryption key + bool encrypt; // encryption enabled? + uint8_t encKey[ENC_LEN]; // encryption key - uint8_t calF[CAL_LEN]; // factory calibration data (not software) - uint8_t joy[JOY_LEN]; // Perhipheral raw data + uint8_t calF[CAL_LEN]; // factory calibration data (not software) + uint8_t joy[JOY_LEN]; // Perhipheral raw data - ecDec_t dec[2]; // device specific decode (two, so we can spot changes) - int decN; // which decode set is most recent {0, 1} - ecCal_t calS; // software calibration data - } -wiiEC_t; + ecDec_t dec[2]; // device specific decode (two, so we can spot changes) + int decN; // which decode set is most recent {0, 1} + ecCal_t calS; // software calibration data +} wiiEC_t; //----------------------------------------------------------------------------- ---------------------------------------- // Function prototypes @@ -159,17 +143,17 @@ wiiEC_t; // top level check() function will handle connect/disconnect messages // -#include // Canvas -typedef struct wiiEC wiiEC_t ; -typedef enum ecCalib ecCalib_t ; -typedef struct state state_t ; -typedef struct eventMsg eventMsg_t ; +#include // Canvas +typedef struct wiiEC wiiEC_t; +typedef enum ecCalib ecCalib_t; +typedef struct state state_t; +typedef struct eventMsg eventMsg_t; -void ecDecode (wiiEC_t* const pec) ; -void ecPoll (wiiEC_t* const pec, FuriMessageQueue* const queue) ; -void ecCalibrate (wiiEC_t* const pec, ecCalib_t c) ; +void ecDecode(wiiEC_t* const pec); +void ecPoll(wiiEC_t* const pec, FuriMessageQueue* const queue); +void ecCalibrate(wiiEC_t* const pec, ecCalib_t c); -void ec_show ( Canvas* const canvas, state_t* const state) ; -bool ec_key (const eventMsg_t* const msg, state_t* const state) ; +void ec_show(Canvas* const canvas, state_t* const state); +bool ec_key(const eventMsg_t* const msg, state_t* const state); #endif //WII_EC_H_ diff --git a/applications/plugins/wii_ec_anal/wii_ec_classic.c b/applications/plugins/wii_ec_anal/wii_ec_classic.c index 91393ba07..5bd3398ca 100644 --- a/applications/plugins/wii_ec_anal/wii_ec_classic.c +++ b/applications/plugins/wii_ec_anal/wii_ec_classic.c @@ -1,17 +1,17 @@ -#include -#include // Core API +#include +#include // Core API -#include "wii_anal.h" -#include "wii_ec.h" -#include "bc_logging.h" +#include "wii_anal.h" +#include "wii_ec.h" +#include "bc_logging.h" //#include "gfx/images.h" // Images -#include "wii_anal_lcd.h" // Drawing functions -#include "wii_anal_keys.h" // key mappings +#include "wii_anal_lcd.h" // Drawing functions +#include "wii_anal_keys.h" // key mappings // ** If you want to see what this source code looks like with all the MACROs expanded // ** grep -v '#include ' wii_i2c_classic.c | gcc -E -o /dev/stdout -xc - -# include "wii_ec_macros.h" +#include "wii_ec_macros.h" //----------------------------------------------------------------------------- ---------------------------------------- // Classic Controller ... Classic Controller Pro is electronically the same @@ -36,102 +36,115 @@ // ...And yes, the left-joystick has an extra 'bit' of precision! // ...Also: trgZ{L|R} WILL continue to increase after btnZ{L|R} has gone active // -void classic_decode (wiiEC_t* const pec) -{ - ecDecClassic_t* p = &pec->dec[(pec->decN = !pec->decN)].classic; - uint8_t* joy = pec->joy; +void classic_decode(wiiEC_t* const pec) { + ecDecClassic_t* p = &pec->dec[(pec->decN = !pec->decN)].classic; + uint8_t* joy = pec->joy; - p->trgZL = ((joy[2] >>2) &0x18) | ((joy[3] >>5) &0x07); // {5} - p->btnZL = !(joy[4] & 0x20); // !{1} + p->trgZL = ((joy[2] >> 2) & 0x18) | ((joy[3] >> 5) & 0x07); // {5} + p->btnZL = !(joy[4] & 0x20); // !{1} - p->trgZR = joy[3] & 0x1F; // {5} - p->btnZR = !(joy[4] & 0x02); // !{1} + p->trgZR = joy[3] & 0x1F; // {5} + p->btnZR = !(joy[4] & 0x02); // !{1} - p->btnL = !(joy[5] & 0x80); // !{1} - p->btnR = !(joy[5] & 0x04); // !{1} + p->btnL = !(joy[5] & 0x80); // !{1} + p->btnR = !(joy[5] & 0x04); // !{1} - p->padU = !(joy[5] & 0x01); // !{1} - p->padD = !(joy[4] & 0x40); // !{1} - p->padL = !(joy[5] & 0x02); // !{1} - p->padR = !(joy[4] & 0x80); // !{1} + p->padU = !(joy[5] & 0x01); // !{1} + p->padD = !(joy[4] & 0x40); // !{1} + p->padL = !(joy[5] & 0x02); // !{1} + p->padR = !(joy[4] & 0x80); // !{1} - p->btnM = !(joy[4] & 0x10); // !{1} - p->btnH = !(joy[4] & 0x08); // !{1} - p->btnP = !(joy[4] & 0x04); // !{1} + p->btnM = !(joy[4] & 0x10); // !{1} + p->btnH = !(joy[4] & 0x08); // !{1} + p->btnP = !(joy[4] & 0x04); // !{1} - p->btnX = !(joy[5] & 0x08); // !{1} - p->btnY = !(joy[5] & 0x20); // !{1} + p->btnX = !(joy[5] & 0x08); // !{1} + p->btnY = !(joy[5] & 0x20); // !{1} - p->btnA = !(joy[5] & 0x10); // !{1} - p->btnB = !(joy[5] & 0x40); // !{1} + p->btnA = !(joy[5] & 0x10); // !{1} + p->btnB = !(joy[5] & 0x40); // !{1} - p->joyLX = joy[0] & 0x3F; // {6} - p->joyLY = joy[1] & 0x3F; // {6} + p->joyLX = joy[0] & 0x3F; // {6} + p->joyLY = joy[1] & 0x3F; // {6} - p->joyRX = ((joy[0] >>3) &0x18) | ((joy[1] >>5) &0x06) | ((joy[2] >>7) &0x01); // {5} - p->joyRY = joy[2] & 0x1F; // {5} + p->joyRX = ((joy[0] >> 3) & 0x18) | ((joy[1] >> 5) & 0x06) | ((joy[2] >> 7) & 0x01); // {5} + p->joyRY = joy[2] & 0x1F; // {5} - DEBUG( ">%d> ZL{%02X}%c, L:%c, R:%c, ZR{%02X}%c", pec->decN, - p->trgZL, (p->btnZL ? '#' : '.'), - (p->btnL ? '#' : '.'), - (p->btnR ? '#' : '.'), - p->trgZR, (p->btnZR ? '#' : '.') - ); - DEBUG( ">%d> D:{%c,%c,%c,%c}, H:{%c,%c,%c}, B:{%c,%c,%c,%c}", pec->decN, - (p->padU ? 'U' : '.'), (p->padD ? 'D' : '.'), (p->padL ? 'L' : '.'), (p->padR ? 'R' : '.'), - (p->btnM ? '-' : '.'), (p->btnH ? 'H' : '.'), (p->btnP ? '+' : '.'), - (p->btnX ? 'X' : '.'), (p->btnY ? 'Y' : '.'), (p->btnA ? 'A' : '.'), (p->btnB ? 'B' : '.') - ); - DEBUG( ">%d> JoyL{x:%02X, y:%02X}, JoyR{x:%02X, y:%02X}", pec->decN, - p->joyLX, p->joyLY, p->joyRX, p->joyRY - ); + DEBUG( + ">%d> ZL{%02X}%c, L:%c, R:%c, ZR{%02X}%c", + pec->decN, + p->trgZL, + (p->btnZL ? '#' : '.'), + (p->btnL ? '#' : '.'), + (p->btnR ? '#' : '.'), + p->trgZR, + (p->btnZR ? '#' : '.')); + DEBUG( + ">%d> D:{%c,%c,%c,%c}, H:{%c,%c,%c}, B:{%c,%c,%c,%c}", + pec->decN, + (p->padU ? 'U' : '.'), + (p->padD ? 'D' : '.'), + (p->padL ? 'L' : '.'), + (p->padR ? 'R' : '.'), + (p->btnM ? '-' : '.'), + (p->btnH ? 'H' : '.'), + (p->btnP ? '+' : '.'), + (p->btnX ? 'X' : '.'), + (p->btnY ? 'Y' : '.'), + (p->btnA ? 'A' : '.'), + (p->btnB ? 'B' : '.')); + DEBUG( + ">%d> JoyL{x:%02X, y:%02X}, JoyR{x:%02X, y:%02X}", + pec->decN, + p->joyLX, + p->joyLY, + p->joyRX, + p->joyRY); } //+============================================================================ ======================================== // Give each button a unique character identifier // -void classic_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) -{ - ecDecClassic_t* new = &pec->dec[pec->decN].classic; - ecDecClassic_t* old = &pec->dec[!pec->decN].classic; +void classic_msg(wiiEC_t* const pec, FuriMessageQueue* const queue) { + ecDecClassic_t* new = &pec->dec[pec->decN].classic; + ecDecClassic_t* old = &pec->dec[!pec->decN].classic; - eventMsg_t msg = { - .id = EVID_WIIEC, - .wiiEc = { - .type = WIIEC_NONE, - .in = ' ', - .val = 0, - } - }; + eventMsg_t msg = { + .id = EVID_WIIEC, + .wiiEc = { + .type = WIIEC_NONE, + .in = ' ', + .val = 0, + }}; - ANALOG(trgZL, 'l'); // FIVE bit value - ANABTN(btnZL, trgZL, 'l'); + ANALOG(trgZL, 'l'); // FIVE bit value + ANABTN(btnZL, trgZL, 'l'); - BUTTON(btnL, 'L'); - BUTTON(btnR, 'R'); + BUTTON(btnL, 'L'); + BUTTON(btnR, 'R'); - ANALOG(trgZR, 'r'); // FIVE bit value - ANABTN(btnZR, trgZR, 'r'); + ANALOG(trgZR, 'r'); // FIVE bit value + ANABTN(btnZR, trgZR, 'r'); - BUTTON(padU, 'W'); - BUTTON(padL, 'A'); - BUTTON(padD, 'S'); - BUTTON(padR, 'D'); + BUTTON(padU, 'W'); + BUTTON(padL, 'A'); + BUTTON(padD, 'S'); + BUTTON(padR, 'D'); - BUTTON(btnM, '-'); - BUTTON(btnH, 'h'); - BUTTON(btnP, '+'); + BUTTON(btnM, '-'); + BUTTON(btnH, 'h'); + BUTTON(btnP, '+'); - BUTTON(btnX, 'x'); - BUTTON(btnY, 'y'); - BUTTON(btnA, 'a'); - BUTTON(btnB, 'b'); + BUTTON(btnX, 'x'); + BUTTON(btnY, 'y'); + BUTTON(btnA, 'a'); + BUTTON(btnB, 'b'); - ANALOG(joyLX, 'x'); // SIX bit values - ANALOG(joyLY, 'y'); + ANALOG(joyLX, 'x'); // SIX bit values + ANALOG(joyLY, 'y'); - ANALOG(joyRX, 'X'); // FIVE bit values - ANALOG(joyRY, 'Y'); + ANALOG(joyRX, 'X'); // FIVE bit values + ANALOG(joyRY, 'Y'); } //+============================================================================ ======================================== @@ -144,255 +157,283 @@ void classic_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) // 9..11 right analog stick Y axis {maximum, minimum, center} ... JoyR is 5bits, so >>3 to compare to readings // 12..15 somehow describe the shoulder {5bit} button values!? // -void classic_calib (wiiEC_t* const pec, ecCalib_t c) -{ - ecDecClassic_t* src = &pec->dec[pec->decN].classic; // from input - ecCalClassic_t* dst = pec->calS.classic; // to calibration data +void classic_calib(wiiEC_t* const pec, ecCalib_t c) { + ecDecClassic_t* src = &pec->dec[pec->decN].classic; // from input + ecCalClassic_t* dst = pec->calS.classic; // to calibration data - if (c & CAL_RESET) { // initialise ready for software calibration - // LO is set to the MAXIMUM value (so it can be reduced) - // HI is set to ZERO (so it can be increased) - RESET_LO_HI(trgZL, 5); // 5bit value - RESET_LO_HI(trgZR, 5); // 5bit value + if(c & CAL_RESET) { // initialise ready for software calibration + // LO is set to the MAXIMUM value (so it can be reduced) + // HI is set to ZERO (so it can be increased) + RESET_LO_HI(trgZL, 5); // 5bit value + RESET_LO_HI(trgZR, 5); // 5bit value - RESET_LO_MID_HI(joyLX, 6); // 6bit value - RESET_LO_MID_HI(joyLY, 6); // 6bit value + RESET_LO_MID_HI(joyLX, 6); // 6bit value + RESET_LO_MID_HI(joyLY, 6); // 6bit value - RESET_LO_MID_HI(joyRX, 5); // 5bit value - RESET_LO_MID_HI(joyRY, 5); // 5bit value - } - if (c & CAL_FACTORY) { // (re)set to factory defaults -//! strategy for factory calibration for classic controller [pro] triggers is (currently) unknown -//! FACTORY_LO( trgZL, pec->calF[12..15]); -//! FACTORY_MID(trgZL, pec->calF[12..15]); -//! FACTORY_HI( trgZL, pec->calF[12..15]); + RESET_LO_MID_HI(joyRX, 5); // 5bit value + RESET_LO_MID_HI(joyRY, 5); // 5bit value + } + if(c & CAL_FACTORY) { // (re)set to factory defaults + //! strategy for factory calibration for classic controller [pro] triggers is (currently) unknown + //! FACTORY_LO( trgZL, pec->calF[12..15]); + //! FACTORY_MID(trgZL, pec->calF[12..15]); + //! FACTORY_HI( trgZL, pec->calF[12..15]); -//! FACTORY_LO( trgZR, pec->calF[12..15]); -//! FACTORY_MID(trgZR, pec->calF[12..15]); -//! FACTORY_HI( trgZR, pec->calF[12..15]); + //! FACTORY_LO( trgZR, pec->calF[12..15]); + //! FACTORY_MID(trgZR, pec->calF[12..15]); + //! FACTORY_HI( trgZR, pec->calF[12..15]); #if 1 - FACTORY_LO(trgZL, 0x03); - FACTORY_LO(trgZR, 0x03); + FACTORY_LO(trgZL, 0x03); + FACTORY_LO(trgZR, 0x03); - FACTORY_MID(trgZL, 0x1B); //! these will be set every time the digital switch changes to ON - FACTORY_MID(trgZR, 0x1B); + FACTORY_MID(trgZL, 0x1B); //! these will be set every time the digital switch changes to ON + FACTORY_MID(trgZR, 0x1B); #endif - FACTORY_LO( joyLX, pec->calF[ 1] >>2); - FACTORY_MID(joyLX, pec->calF[ 2] >>2); - FACTORY_HI( joyLX, pec->calF[ 0] >>2); + FACTORY_LO(joyLX, pec->calF[1] >> 2); + FACTORY_MID(joyLX, pec->calF[2] >> 2); + FACTORY_HI(joyLX, pec->calF[0] >> 2); - FACTORY_LO( joyLY, pec->calF[ 4] >>2); - FACTORY_MID(joyLY, pec->calF[ 5] >>2); - FACTORY_HI( joyLY, pec->calF[ 3] >>2); + FACTORY_LO(joyLY, pec->calF[4] >> 2); + FACTORY_MID(joyLY, pec->calF[5] >> 2); + FACTORY_HI(joyLY, pec->calF[3] >> 2); - FACTORY_LO( joyRX, pec->calF[ 7] >>3); - FACTORY_MID(joyRX, pec->calF[ 8] >>3); - FACTORY_HI( joyRX, pec->calF[ 6] >>3); + FACTORY_LO(joyRX, pec->calF[7] >> 3); + FACTORY_MID(joyRX, pec->calF[8] >> 3); + FACTORY_HI(joyRX, pec->calF[6] >> 3); - FACTORY_LO( joyRY, pec->calF[10] >>3); - FACTORY_MID(joyRY, pec->calF[11] >>3); - FACTORY_HI( joyRY, pec->calF[ 9] >>3); - } - if (c & CAL_TRACK) { // track maximum and minimum values seen - TRACK_LO_HI(trgZL); - TRACK_LO_HI(trgZR); + FACTORY_LO(joyRY, pec->calF[10] >> 3); + FACTORY_MID(joyRY, pec->calF[11] >> 3); + FACTORY_HI(joyRY, pec->calF[9] >> 3); + } + if(c & CAL_TRACK) { // track maximum and minimum values seen + TRACK_LO_HI(trgZL); + TRACK_LO_HI(trgZR); - TRACK_LO_HI(joyLX); - TRACK_LO_HI(joyLY); + TRACK_LO_HI(joyLX); + TRACK_LO_HI(joyLY); - TRACK_LO_HI(joyRX); - TRACK_LO_HI(joyRY); - } - if (c & CAL_RANGE) { // perform software calibration step - RANGE_LO_HI(trgZL); - RANGE_LO_HI(trgZR); + TRACK_LO_HI(joyRX); + TRACK_LO_HI(joyRY); + } + if(c & CAL_RANGE) { // perform software calibration step + RANGE_LO_HI(trgZL); + RANGE_LO_HI(trgZR); - RANGE_LO_HI(joyLX); - RANGE_LO_HI(joyLY); + RANGE_LO_HI(joyLX); + RANGE_LO_HI(joyLY); - RANGE_LO_HI(joyRX); - RANGE_LO_HI(joyRY); - } - if (c & CAL_CENTRE) { // reset centre point of joystick - CENTRE(joyLX); - CENTRE(joyLY); + RANGE_LO_HI(joyRX); + RANGE_LO_HI(joyRY); + } + if(c & CAL_CENTRE) { // reset centre point of joystick + CENTRE(joyLX); + CENTRE(joyLY); - CENTRE(joyRX); - CENTRE(joyRY); - } + CENTRE(joyRX); + CENTRE(joyRY); + } } //+============================================================================ ======================================== // bits that are common to both screens // -static -void classic_show_ (Canvas* const canvas, state_t* const state) -{ - ecDecClassic_t* d = &state->ec.dec[state->ec.decN].classic; - ecCalClassic_t* js = state->ec.calS.classic; +static void classic_show_(Canvas* const canvas, state_t* const state) { + ecDecClassic_t* d = &state->ec.dec[state->ec.decN].classic; + ecCalClassic_t* js = state->ec.calS.classic; - static const int dead = 1; // trigger deadzone - const image_t* img = NULL; // trigger image + static const int dead = 1; // trigger deadzone + const image_t* img = NULL; // trigger image - show(canvas, 6, 0, &img_cc_Main , SHOW_SET_BLK); - show(canvas, 62,53, &img_cc_Cable, SHOW_SET_BLK); + show(canvas, 6, 0, &img_cc_Main, SHOW_SET_BLK); + show(canvas, 62, 53, &img_cc_Cable, SHOW_SET_BLK); - // classic triggers - if (d->trgZL >= js[2].trgZL ) img = &img_cc_trg_L4; - else if (d->trgZL <= js[1].trgZL +dead) img = NULL; - else { - // copied from the joystick calibration code - int lo = js[1].trgZL +dead +1; - int hi = js[2].trgZL -1; - int range = hi -lo +1; - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) - int hi1 = lo +div -1; // (in brevity) - int lo3 = lo +div +div +(rem==2); // ... + // classic triggers + if(d->trgZL >= js[2].trgZL) + img = &img_cc_trg_L4; + else if(d->trgZL <= js[1].trgZL + dead) + img = NULL; + else { + // copied from the joystick calibration code + int lo = js[1].trgZL + dead + 1; + int hi = js[2].trgZL - 1; + int range = hi - lo + 1; + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) + int hi1 = lo + div - 1; // (in brevity) + int lo3 = lo + div + div + (rem == 2); // ... - if (d->trgZL <= hi1) img = &img_cc_trg_L1 ; // zone #1 - else if (d->trgZL >= lo3) img = &img_cc_trg_L3 ; // zone #3 - else img = &img_cc_trg_L2 ; // zone #2 - } - if (img) show(canvas, 22,1, img, SHOW_SET_BLK) ; + if(d->trgZL <= hi1) + img = &img_cc_trg_L1; // zone #1 + else if(d->trgZL >= lo3) + img = &img_cc_trg_L3; // zone #3 + else + img = &img_cc_trg_L2; // zone #2 + } + if(img) show(canvas, 22, 1, img, SHOW_SET_BLK); - if (d->trgZR >= js[2].trgZR ) img = &img_cc_trg_R4; - else if (d->trgZR <= js[1].trgZR +dead) img = NULL; - else { - // copied from the joystick calibration code - int lo = js[1].trgZR +dead +1; - int hi = js[2].trgZR -1; - int range = hi -lo +1; - int div = range /3; // each division (base amount, eg. 17/3==5) - int rem = range -(div *3); // remainder (ie. range%3) - int hi1 = lo +div -1; // (in brevity) - int lo3 = lo +div +div +(rem==2); // ... + if(d->trgZR >= js[2].trgZR) + img = &img_cc_trg_R4; + else if(d->trgZR <= js[1].trgZR + dead) + img = NULL; + else { + // copied from the joystick calibration code + int lo = js[1].trgZR + dead + 1; + int hi = js[2].trgZR - 1; + int range = hi - lo + 1; + int div = range / 3; // each division (base amount, eg. 17/3==5) + int rem = range - (div * 3); // remainder (ie. range%3) + int hi1 = lo + div - 1; // (in brevity) + int lo3 = lo + div + div + (rem == 2); // ... - if (d->trgZR <= hi1) img = &img_cc_trg_R1 ; // zone #1 - else if (d->trgZR >= lo3) img = &img_cc_trg_R3 ; // zone #3 - else img = &img_cc_trg_R2 ; // zone #2 - } - if (img) show(canvas, 89,1, img, SHOW_SET_BLK) ; + if(d->trgZR <= hi1) + img = &img_cc_trg_R1; // zone #1 + else if(d->trgZR >= lo3) + img = &img_cc_trg_R3; // zone #3 + else + img = &img_cc_trg_R2; // zone #2 + } + if(img) show(canvas, 89, 1, img, SHOW_SET_BLK); - if (d->padU ) show(canvas, 27,16, &img_cc_pad_UD1, SHOW_ALL) ; - if (d->padL ) show(canvas, 20,23, &img_cc_pad_LR1, SHOW_ALL) ; - if (d->padD ) show(canvas, 27,28, &img_cc_pad_UD1, SHOW_ALL) ; - if (d->padR ) show(canvas, 32,23, &img_cc_pad_LR1, SHOW_ALL) ; + if(d->padU) show(canvas, 27, 16, &img_cc_pad_UD1, SHOW_ALL); + if(d->padL) show(canvas, 20, 23, &img_cc_pad_LR1, SHOW_ALL); + if(d->padD) show(canvas, 27, 28, &img_cc_pad_UD1, SHOW_ALL); + if(d->padR) show(canvas, 32, 23, &img_cc_pad_LR1, SHOW_ALL); - if (d->btnX ) show(canvas, 96,16, &img_cc_btn_X1, SHOW_ALL) ; - if (d->btnY ) show(canvas, 85,23, &img_cc_btn_Y1, SHOW_ALL) ; - if (d->btnA ) show(canvas, 107,23, &img_cc_btn_A1, SHOW_ALL) ; - if (d->btnB ) show(canvas, 96,30, &img_cc_btn_B1, SHOW_ALL) ; + if(d->btnX) show(canvas, 96, 16, &img_cc_btn_X1, SHOW_ALL); + if(d->btnY) show(canvas, 85, 23, &img_cc_btn_Y1, SHOW_ALL); + if(d->btnA) show(canvas, 107, 23, &img_cc_btn_A1, SHOW_ALL); + if(d->btnB) show(canvas, 96, 30, &img_cc_btn_B1, SHOW_ALL); - canvas_set_color(canvas, ColorBlack); - if (d->btnL ) canvas_draw_box(canvas, 46,2, 5,4) ; - if (d->btnR ) canvas_draw_box(canvas, 77,2, 5,4) ; + canvas_set_color(canvas, ColorBlack); + if(d->btnL) canvas_draw_box(canvas, 46, 2, 5, 4); + if(d->btnR) canvas_draw_box(canvas, 77, 2, 5, 4); - if (d->btnM ) canvas_draw_box(canvas, 54,24, 4,4) ; - if (d->btnH ) canvas_draw_box(canvas, 62,24, 4,4) ; - if (d->btnP ) canvas_draw_box(canvas, 70,24, 4,4) ; + if(d->btnM) canvas_draw_box(canvas, 54, 24, 4, 4); + if(d->btnH) canvas_draw_box(canvas, 62, 24, 4, 4); + if(d->btnP) canvas_draw_box(canvas, 70, 24, 4, 4); - // Show joysticks - showJoy(canvas, 48,42, js[1].joyLX,js[2].joyLX, js[3].joyLX, - js[1].joyLY,js[2].joyLY, js[3].joyLY, d->joyLX,d->joyLY, 6); - showJoy(canvas, 78,42, js[1].joyRX,js[2].joyRX, js[3].joyRX, - js[1].joyRY,js[2].joyRY, js[3].joyRY, d->joyRX,d->joyRY, 5); + // Show joysticks + showJoy( + canvas, + 48, + 42, + js[1].joyLX, + js[2].joyLX, + js[3].joyLX, + js[1].joyLY, + js[2].joyLY, + js[3].joyLY, + d->joyLX, + d->joyLY, + 6); + showJoy( + canvas, + 78, + 42, + js[1].joyRX, + js[2].joyRX, + js[3].joyRX, + js[1].joyRY, + js[2].joyRY, + js[3].joyRY, + d->joyRX, + d->joyRY, + 5); - show(canvas, 0,55, &img_key_L, SHOW_SET_BLK); + show(canvas, 0, 55, &img_key_L, SHOW_SET_BLK); } //+============================================================================ ======================================== -static -void classic_showN (Canvas* const canvas, state_t* const state) -{ - ecCalClassic_t* c = (state->hold) ? &state->ec.calS.classic[(state->hold < 0) ? 0 : 4] - : (ecCalClassic_t*)(&state->ec.dec[state->ec.decN].classic) ; //! danger +static void classic_showN(Canvas* const canvas, state_t* const state) { + ecCalClassic_t* c = (state->hold) ? + &state->ec.calS.classic[(state->hold < 0) ? 0 : 4] : + (ecCalClassic_t*)(&state->ec.dec[state->ec.decN].classic); //! danger - classic_show_(canvas, state); + classic_show_(canvas, state); - showHex(canvas, 0, 0, c->trgZL, 2,1); // 5bits - showHex(canvas, 113, 0, c->trgZR, 2,1); // 5bits + showHex(canvas, 0, 0, c->trgZL, 2, 1); // 5bits + showHex(canvas, 113, 0, c->trgZR, 2, 1); // 5bits - showHex(canvas, 24,41, c->joyLX, 2,1); // 6bits - showHex(canvas, 41,54, c->joyLY, 2,1); // 6bits + showHex(canvas, 24, 41, c->joyLX, 2, 1); // 6bits + showHex(canvas, 41, 54, c->joyLY, 2, 1); // 6bits - showHex(canvas, 88,41, c->joyRX, 2,1); // 5bits - showHex(canvas, 71,54, c->joyRY, 2,1); // 5bits + showHex(canvas, 88, 41, c->joyRX, 2, 1); // 5bits + showHex(canvas, 71, 54, c->joyRY, 2, 1); // 5bits - showPeakHold(state, canvas, state->hold); // peak keys + showPeakHold(state, canvas, state->hold); // peak keys } //+============================================================================ ======================================== -void classic_show (Canvas* const canvas, state_t* const state) -{ - // Classic controllers have TWO scenes - if (state->scene == SCENE_CLASSIC_N) return classic_showN(canvas, state) ; +void classic_show(Canvas* const canvas, state_t* const state) { + // Classic controllers have TWO scenes + if(state->scene == SCENE_CLASSIC_N) return classic_showN(canvas, state); - // Default scene - classic_show_(canvas, state); - show(canvas, 9,55, &img_key_R, SHOW_SET_BLK); + // Default scene + classic_show_(canvas, state); + show(canvas, 9, 55, &img_key_R, SHOW_SET_BLK); - show( canvas, 119,55, - ((state->calib & CAL_RANGE) && (++state->flash &8)) ? &img_key_OKi : &img_key_OK, - SHOW_SET_BLK ); + show( + canvas, + 119, + 55, + ((state->calib & CAL_RANGE) && (++state->flash & 8)) ? &img_key_OKi : &img_key_OK, + SHOW_SET_BLK); } //+============================================================================ ======================================== -static -bool classic_keyN (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +static bool classic_keyN(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - if ((msg->input.type == InputTypeShort) && (msg->input.key == InputKeyLeft)) { - sceneSet(state, SCENE_CLASSIC); - used = true; - } + if((msg->input.type == InputTypeShort) && (msg->input.key == InputKeyLeft)) { + sceneSet(state, SCENE_CLASSIC); + used = true; + } - // Calibration keys - if (!used) used = key_calib(msg, state) ; + // Calibration keys + if(!used) used = key_calib(msg, state); - return used; + return used; } //+============================================================================ ======================================== -bool classic_key (const eventMsg_t* const msg, state_t* const state) -{ - // Classic controllers have TWO scenes - if (state->scene == SCENE_CLASSIC_N) return classic_keyN(msg, state) ; +bool classic_key(const eventMsg_t* const msg, state_t* const state) { + // Classic controllers have TWO scenes + if(state->scene == SCENE_CLASSIC_N) return classic_keyN(msg, state); - // Default scene - int used = false; // assume key is NOT-handled + // Default scene + int used = false; // assume key is NOT-handled - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyUp: //# input.type) { + case InputTypeShort: //# input.key) { + case InputKeyUp: //# -#include +#include +#include //----------------------------------------------------------------------------- ---------------------------------------- // Classic Controller ... Classic Controller Pro is electronically the same @@ -25,60 +25,55 @@ //----------------------------------------------------------------------------- ---------------------------------------- // Controllers which have calibration must have their calibratable controls here //! Is there a better way to get the start of the decode struct to match the calibration struct ? -#define CLASSIC_ANALOGUE \ - uint8_t trgZL, trgZR; /* ANA{l, l} lowercase=trigger 5bit values {5} */ \ - uint8_t joyLX, joyLY; /* ANA{x, y} left=lowercase 6bit values {6}<-- */ \ - uint8_t joyRX, joyRY; /* ANA{X, Y} 5bit values {5} */ +#define CLASSIC_ANALOGUE \ + uint8_t trgZL, trgZR; /* ANA{l, l} lowercase=trigger 5bit values {5} */ \ + uint8_t joyLX, joyLY; /* ANA{x, y} left=lowercase 6bit values {6}<-- */ \ + uint8_t joyRX, joyRY; /* ANA{X, Y} 5bit values {5} */ //----------------------------------------------------------------------------- // Calibratable controls // -typedef - struct ecCalClassic - { - CLASSIC_ANALOGUE - } -ecCalClassic_t; +typedef struct ecCalClassic { + CLASSIC_ANALOGUE +} ecCalClassic_t; //----------------------------------------------------------------------------- // All controls // -typedef - struct ecDecClassic - { - CLASSIC_ANALOGUE // MUST be first +typedef struct ecDecClassic { + CLASSIC_ANALOGUE // MUST be first - // Digital controls - bool btnZL, btnZR; // BTN{l, l} + // Digital controls + bool btnZL, + btnZR; // BTN{l, l} - bool btnL, btnR; // BTN{L, R} upperrcase=shoulder + bool btnL, btnR; // BTN{L, R} upperrcase=shoulder - bool padU, padL, padD, padR; // BTN{W, A, S, D} + bool padU, padL, padD, padR; // BTN{W, A, S, D} - bool btnM, btnH, btnP; // BTN{-, h, +} + bool btnM, btnH, btnP; // BTN{-, h, +} - bool btnX, btnY; // BTN{x, y} - bool btnA, btnB; // BTN{a, b} + bool btnX, btnY; // BTN{x, y} + bool btnA, btnB; // BTN{a, b} - } -ecDecClassic_t; +} ecDecClassic_t; #undef CLASSIC_ANALOGUE //============================================================================= ======================================== // Function prototypes // -#include // Canvas -typedef struct wiiEC wiiEC_t ; -typedef enum ecCalib ecCalib_t ; -typedef struct state state_t ; -typedef struct eventMsg eventMsg_t ; +#include // Canvas +typedef struct wiiEC wiiEC_t; +typedef enum ecCalib ecCalib_t; +typedef struct state state_t; +typedef struct eventMsg eventMsg_t; -void classic_decode (wiiEC_t* const pec) ; -void classic_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) ; -void classic_calib (wiiEC_t* const pec, ecCalib_t c) ; +void classic_decode(wiiEC_t* const pec); +void classic_msg(wiiEC_t* const pec, FuriMessageQueue* const queue); +void classic_calib(wiiEC_t* const pec, ecCalib_t c); -void classic_show (Canvas* const canvas, state_t* const state) ; -bool classic_key (const eventMsg_t* const msg, state_t* const state) ; +void classic_show(Canvas* const canvas, state_t* const state); +bool classic_key(const eventMsg_t* const msg, state_t* const state); #endif //WII_EC_CLASSIC_H_ diff --git a/applications/plugins/wii_ec_anal/wii_ec_macros.h b/applications/plugins/wii_ec_anal/wii_ec_macros.h index 33daf944d..00ab9825b 100644 --- a/applications/plugins/wii_ec_anal/wii_ec_macros.h +++ b/applications/plugins/wii_ec_anal/wii_ec_macros.h @@ -9,49 +9,53 @@ // //if (furi_message_queue_get_count(queue) > 18) WARN("queue high %d", furi_message_queue_get_count(queue)); -#define MSGQ(lbl) do { \ - msg.wiiEc.in = lbl; \ - furi_message_queue_put(queue, &msg, 0); \ -}while(0) - +#define MSGQ(lbl) \ + do { \ + msg.wiiEc.in = lbl; \ + furi_message_queue_put(queue, &msg, 0); \ + } while(0) // A 'standard' "button" is an independent SPST switch // Eg. Nunchuck 'Z' button // The "value" will always be 0 -#define BUTTON(btn,lbl) do { \ - if (new->btn != old->btn) { \ - msg.wiiEc.type = (new->btn) ? WIIEC_PRESS : WIIEC_RELEASE; \ - msg.wiiEc.val = 0; \ - MSGQ(lbl); \ - } \ -}while(0) +#define BUTTON(btn, lbl) \ + do { \ + if(new->btn != old->btn) { \ + msg.wiiEc.type = (new->btn) ? WIIEC_PRESS : WIIEC_RELEASE; \ + msg.wiiEc.val = 0; \ + MSGQ(lbl); \ + } \ + } while(0) // An "analogue button" is an SPST coupled with an ananlogue 'switch' // Eg. The "bottom out" switches on the triggers of the classic controller // The "value" will be the value of the associated analogue controller -#define ANABTN(btn,ana,lbl) do { \ - if (new->btn != old->btn) { \ - msg.wiiEc.type = (new->btn) ? WIIEC_PRESS : WIIEC_RELEASE; \ - msg.wiiEc.val = new->ana; \ - MSGQ(lbl); \ - } \ -}while(0) +#define ANABTN(btn, ana, lbl) \ + do { \ + if(new->btn != old->btn) { \ + msg.wiiEc.type = (new->btn) ? WIIEC_PRESS : WIIEC_RELEASE; \ + msg.wiiEc.val = new->ana; \ + MSGQ(lbl); \ + } \ + } while(0) -#define ANALOG(ana,lbl) do { \ - if (new->ana != old->ana) { \ - msg.wiiEc.type = WIIEC_ANALOG; \ - msg.wiiEc.val = new->ana; \ - MSGQ(lbl); \ - } \ -}while(0) +#define ANALOG(ana, lbl) \ + do { \ + if(new->ana != old->ana) { \ + msg.wiiEc.type = WIIEC_ANALOG; \ + msg.wiiEc.val = new->ana; \ + MSGQ(lbl); \ + } \ + } while(0) -#define ACCEL(acc,lbl) do { \ - if (new->acc != old->acc) { \ - msg.wiiEc.type = WIIEC_ACCEL; \ - msg.wiiEc.val = new->acc; \ - MSGQ(lbl); \ - } \ -}while(0) +#define ACCEL(acc, lbl) \ + do { \ + if(new->acc != old->acc) { \ + msg.wiiEc.type = WIIEC_ACCEL; \ + msg.wiiEc.val = new->acc; \ + MSGQ(lbl); \ + } \ + } while(0) //----------------------------------------------------------------------------- ---------------------------------------- // CALIBRATION MACROS @@ -61,24 +65,74 @@ // // ... v=variable, n=number // -#define FACTORY_LO(v,n) do{ (dst[1]. v) = n; }while(0) -#define FACTORY_MID(v,n) do{ (dst[2]. v) = n; }while(0) -#define FACTORY_HI(v,n) do{ (dst[3]. v) = n; }while(0) +#define FACTORY_LO(v, n) \ + do { \ + (dst[1].v) = n; \ + } while(0) +#define FACTORY_MID(v, n) \ + do { \ + (dst[2].v) = n; \ + } while(0) +#define FACTORY_HI(v, n) \ + do { \ + (dst[3].v) = n; \ + } while(0) -#define TRACK_LO(v) do{ if ((src-> v) < (dst[0]. v)) (dst[0]. v) = (src-> v); }while(0) -#define TRACK_HI(v) do{ if ((src-> v) > (dst[4]. v)) (dst[4]. v) = (src-> v); }while(0) -#define TRACK_LO_HI(v) do{ TRACK_LO(v); TRACK_HI(v); }while(0) +#define TRACK_LO(v) \ + do { \ + if((src->v) < (dst[0].v)) (dst[0].v) = (src->v); \ + } while(0) +#define TRACK_HI(v) \ + do { \ + if((src->v) > (dst[4].v)) (dst[4].v) = (src->v); \ + } while(0) +#define TRACK_LO_HI(v) \ + do { \ + TRACK_LO(v); \ + TRACK_HI(v); \ + } while(0) -#define RESET_LO(v,b) do{ (dst[0]. v) = (dst[1]. v) = ((1<<(b))-1); }while(0) -#define RESET_HI(v) do{ (dst[4]. v) = (dst[3]. v) = 0; }while(0) -#define RESET_MID(v) do{ (dst[2]. v) = (src-> v); }while(0) -#define RESET_LO_HI(v,b) do{ RESET_LO(v,b); RESET_HI(v); }while(0) -#define RESET_LO_MID_HI(v,b) do{ RESET_LO(v,b); RESET_MID(v); RESET_HI(v); }while(0) +#define RESET_LO(v, b) \ + do { \ + (dst[0].v) = (dst[1].v) = ((1 << (b)) - 1); \ + } while(0) +#define RESET_HI(v) \ + do { \ + (dst[4].v) = (dst[3].v) = 0; \ + } while(0) +#define RESET_MID(v) \ + do { \ + (dst[2].v) = (src->v); \ + } while(0) +#define RESET_LO_HI(v, b) \ + do { \ + RESET_LO(v, b); \ + RESET_HI(v); \ + } while(0) +#define RESET_LO_MID_HI(v, b) \ + do { \ + RESET_LO(v, b); \ + RESET_MID(v); \ + RESET_HI(v); \ + } while(0) -#define RANGE_LO(v) do{ if ((src-> v) < (dst[1]. v)) (dst[1]. v) = (src-> v); }while(0) -#define RANGE_HI(v) do{ if ((src-> v) > (dst[3]. v)) (dst[3]. v) = (src-> v); }while(0) -#define RANGE_LO_HI(v) do{ RANGE_LO(v); RANGE_HI(v); }while(0) +#define RANGE_LO(v) \ + do { \ + if((src->v) < (dst[1].v)) (dst[1].v) = (src->v); \ + } while(0) +#define RANGE_HI(v) \ + do { \ + if((src->v) > (dst[3].v)) (dst[3].v) = (src->v); \ + } while(0) +#define RANGE_LO_HI(v) \ + do { \ + RANGE_LO(v); \ + RANGE_HI(v); \ + } while(0) -#define CENTRE(v) do{ (dst[2]. v) = (src-> v); } while(0) +#define CENTRE(v) \ + do { \ + (dst[2].v) = (src->v); \ + } while(0) #endif //WII_EC_MACROS_H_ diff --git a/applications/plugins/wii_ec_anal/wii_ec_nunchuck.c b/applications/plugins/wii_ec_anal/wii_ec_nunchuck.c index 81c32a243..d88d535b6 100644 --- a/applications/plugins/wii_ec_anal/wii_ec_nunchuck.c +++ b/applications/plugins/wii_ec_anal/wii_ec_nunchuck.c @@ -1,142 +1,144 @@ -#include -#include // Core API +#include +#include // Core API -#include "wii_anal.h" -#include "wii_i2c.h" -#include "bc_logging.h" +#include "wii_anal.h" +#include "wii_i2c.h" +#include "bc_logging.h" -#include "gfx/images.h" // Images -#include "wii_anal_lcd.h" // Drawing functions -#include "wii_anal_keys.h" // key mappings +#include "gfx/images.h" // Images +#include "wii_anal_lcd.h" // Drawing functions +#include "wii_anal_keys.h" // key mappings // ** If you want to see what this source code looks like with all the MACROs expanded // ** grep -v '#include ' wii_ec_nunchuck.c | gcc -E -o /dev/stdout -xc - -# include "wii_ec_macros.h" +#include "wii_ec_macros.h" //+============================================================================ ======================================== // Standard Nunchuck : 2 buttons, 1 analogue joystick, 1 3-axis accelerometer -// -void nunchuck_decode (wiiEC_t* const pec) -{ - ecDecNunchuck_t* p = &pec->dec[(pec->decN = !pec->decN)].nunchuck; - uint8_t* joy = pec->joy; +// +void nunchuck_decode(wiiEC_t* const pec) { + ecDecNunchuck_t* p = &pec->dec[(pec->decN = !pec->decN)].nunchuck; + uint8_t* joy = pec->joy; - p->btnC = !(joy[5] & 0x02); // !{1} - p->btnZ = !(joy[5] & 0x01); // !{1} + p->btnC = !(joy[5] & 0x02); // !{1} + p->btnZ = !(joy[5] & 0x01); // !{1} - p->joyX = joy[0]; // {8} - p->joyY = joy[1]; // {8} + p->joyX = joy[0]; // {8} + p->joyY = joy[1]; // {8} - p->accX = ((uint16_t)joy[2] << 2) | ((joy[5] >>2) & 0x03); // {10} - p->accY = ((uint16_t)joy[3] << 2) | ((joy[5] >>4) & 0x03); // {10} - p->accZ = ((uint16_t)joy[4] << 2) | ((joy[5] >>6) & 0x03); // {10} + p->accX = ((uint16_t)joy[2] << 2) | ((joy[5] >> 2) & 0x03); // {10} + p->accY = ((uint16_t)joy[3] << 2) | ((joy[5] >> 4) & 0x03); // {10} + p->accZ = ((uint16_t)joy[4] << 2) | ((joy[5] >> 6) & 0x03); // {10} - DEBUG(">%d> C:%c, Z:%c, Joy{x:%02X, y:%02X}, Acc{x:%03X, y:%03X, z:%03X}", pec->decN, - (p->btnC ? '#' : '.'), (p->btnZ ? '#' : '.'), - p->joyX, p->joyY, p->accX, p->accY, p->accZ - ); + DEBUG( + ">%d> C:%c, Z:%c, Joy{x:%02X, y:%02X}, Acc{x:%03X, y:%03X, z:%03X}", + pec->decN, + (p->btnC ? '#' : '.'), + (p->btnZ ? '#' : '.'), + p->joyX, + p->joyY, + p->accX, + p->accY, + p->accZ); } //+============================================================================ ======================================== // Give each button a unique character identifier // -void nunchuck_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) -{ - ecDecNunchuck_t* new = &pec->dec[pec->decN].nunchuck; - ecDecNunchuck_t* old = &pec->dec[!pec->decN].nunchuck; +void nunchuck_msg(wiiEC_t* const pec, FuriMessageQueue* const queue) { + ecDecNunchuck_t* new = &pec->dec[pec->decN].nunchuck; + ecDecNunchuck_t* old = &pec->dec[!pec->decN].nunchuck; - eventMsg_t msg = { - .id = EVID_WIIEC, - .wiiEc = { - .type = WIIEC_NONE, - .in = ' ', - .val = 0, - } - }; + eventMsg_t msg = { + .id = EVID_WIIEC, + .wiiEc = { + .type = WIIEC_NONE, + .in = ' ', + .val = 0, + }}; - BUTTON(btnC, 'c'); - BUTTON(btnZ, 'z'); + BUTTON(btnC, 'c'); + BUTTON(btnZ, 'z'); - ANALOG(joyX, 'x'); - ANALOG(joyY, 'y'); + ANALOG(joyX, 'x'); + ANALOG(joyY, 'y'); - ACCEL(accX, 'x'); - ACCEL(accY, 'y'); - ACCEL(accZ, 'z'); + ACCEL(accX, 'x'); + ACCEL(accY, 'y'); + ACCEL(accZ, 'z'); } //+============================================================================ ======================================== // https://www.hackster.io/infusion/using-a-wii-nunchuk-with-arduino-597254#toc-5--read-actual-calibration-data-from-the-device-14 // -void nunchuck_calib (wiiEC_t* const pec, ecCalib_t c) -{ - ecDecNunchuck_t* src = &pec->dec[pec->decN].nunchuck; // from input - ecCalNunchuck_t* dst = pec->calS.nunchuck; // to calibration data +void nunchuck_calib(wiiEC_t* const pec, ecCalib_t c) { + ecDecNunchuck_t* src = &pec->dec[pec->decN].nunchuck; // from input + ecCalNunchuck_t* dst = pec->calS.nunchuck; // to calibration data - if (c & CAL_RESET) { // initialise ready for software calibration - // LO is set to the MAXIMUM value (so it can be reduced) - // HI is set to ZERO (so it can be increased) - RESET_LO_HI(accX, 10); // 10bit value - RESET_LO_HI(accY, 10); // 10bit value - RESET_LO_HI(accZ, 10); // 10bit value + if(c & CAL_RESET) { // initialise ready for software calibration + // LO is set to the MAXIMUM value (so it can be reduced) + // HI is set to ZERO (so it can be increased) + RESET_LO_HI(accX, 10); // 10bit value + RESET_LO_HI(accY, 10); // 10bit value + RESET_LO_HI(accZ, 10); // 10bit value - RESET_LO_HI(joyX, 8); // 8bit value - RESET_LO_HI(joyY, 8); // 8bit value - } - if (c & CAL_FACTORY) { // (re)set to factory defaults - //! "[4] LSB of Zero value of X,Y,Z axes" ...helpful! - //! ...Well, my test nunchuck has bits set in the bottom 6 bits, so let's guess ;) + RESET_LO_HI(joyX, 8); // 8bit value + RESET_LO_HI(joyY, 8); // 8bit value + } + if(c & CAL_FACTORY) { // (re)set to factory defaults + //! "[4] LSB of Zero value of X,Y,Z axes" ...helpful! + //! ...Well, my test nunchuck has bits set in the bottom 6 bits, so let's guess ;) - // No value available - annecdotal tests suggest 8 is reasonable - FACTORY_LO( accX, 8); - FACTORY_LO( accY, 8); - FACTORY_LO( accZ, 8); + // No value available - annecdotal tests suggest 8 is reasonable + FACTORY_LO(accX, 8); + FACTORY_LO(accY, 8); + FACTORY_LO(accZ, 8); - // @ 0G - FACTORY_MID( accX, ((pec->calF[0] <<2) | ((pec->calF[3] >>4) &0x3)) ) ; - FACTORY_MID( accY, ((pec->calF[1] <<2) | ((pec->calF[3] >>2) &0x3)) ) ; - FACTORY_MID( accZ, ((pec->calF[2] <<2) | ((pec->calF[3] ) &0x3)) ) ; + // @ 0G + FACTORY_MID(accX, ((pec->calF[0] << 2) | ((pec->calF[3] >> 4) & 0x3))); + FACTORY_MID(accY, ((pec->calF[1] << 2) | ((pec->calF[3] >> 2) & 0x3))); + FACTORY_MID(accZ, ((pec->calF[2] << 2) | ((pec->calF[3]) & 0x3))); - // @ 1G - FACTORY_HI( accX, ((pec->calF[4] <<2) | ((pec->calF[7] >>4) &0x3)) ) ; - FACTORY_HI( accY, ((pec->calF[5] <<2) | ((pec->calF[7] >>2) &0x3)) ) ; - FACTORY_HI( accZ, ((pec->calF[6] <<2) | ((pec->calF[7] ) &0x3)) ) ; + // @ 1G + FACTORY_HI(accX, ((pec->calF[4] << 2) | ((pec->calF[7] >> 4) & 0x3))); + FACTORY_HI(accY, ((pec->calF[5] << 2) | ((pec->calF[7] >> 2) & 0x3))); + FACTORY_HI(accZ, ((pec->calF[6] << 2) | ((pec->calF[7]) & 0x3))); - // Joysticks - FACTORY_LO( joyX, pec->calF[ 9] ) ; - FACTORY_MID(joyX, pec->calF[10] ) ; - FACTORY_HI( joyX, pec->calF[ 8] ) ; + // Joysticks + FACTORY_LO(joyX, pec->calF[9]); + FACTORY_MID(joyX, pec->calF[10]); + FACTORY_HI(joyX, pec->calF[8]); - FACTORY_LO( joyY, pec->calF[12] ) ; - FACTORY_MID(joyY, pec->calF[13] ) ; - FACTORY_HI( joyY, pec->calF[11] ) ; - } - if (c & CAL_TRACK) { // track maximum and minimum values seen - TRACK_LO_HI(accX); - TRACK_LO_HI(accY); - TRACK_LO_HI(accZ); + FACTORY_LO(joyY, pec->calF[12]); + FACTORY_MID(joyY, pec->calF[13]); + FACTORY_HI(joyY, pec->calF[11]); + } + if(c & CAL_TRACK) { // track maximum and minimum values seen + TRACK_LO_HI(accX); + TRACK_LO_HI(accY); + TRACK_LO_HI(accZ); - TRACK_LO_HI(joyX); - TRACK_LO_HI(joyY); - } - if (c & CAL_RANGE) { // perform software calibration step - RANGE_LO_HI(accX); - RANGE_LO_HI(accY); - RANGE_LO_HI(accZ); + TRACK_LO_HI(joyX); + TRACK_LO_HI(joyY); + } + if(c & CAL_RANGE) { // perform software calibration step + RANGE_LO_HI(accX); + RANGE_LO_HI(accY); + RANGE_LO_HI(accZ); - if (!(c & CAL_NOTJOY)) { // double negative! - RANGE_LO_HI(joyX); - RANGE_LO_HI(joyY); - } - } - if (c & CAL_CENTRE) { // reset centre point of joystick - CENTRE(accX); - CENTRE(accY); - CENTRE(accZ); + if(!(c & CAL_NOTJOY)) { // double negative! + RANGE_LO_HI(joyX); + RANGE_LO_HI(joyY); + } + } + if(c & CAL_CENTRE) { // reset centre point of joystick + CENTRE(accX); + CENTRE(accY); + CENTRE(accZ); - CENTRE(joyX); - CENTRE(joyY); - } + CENTRE(joyX); + CENTRE(joyY); + } } //============================================================================= ======================================== @@ -152,308 +154,323 @@ void nunchuck_calib (wiiEC_t* const pec, ecCalib_t c) // // EG. Move left will effect X ; turn left will effect Y & Z // -#define aw 110 // axis width -#define ah 15 // height {0......7......14} -#define am 7 // midpoint { 7 } -#define ar 7 // range {1234567 1234567} +#define aw 110 // axis width +#define ah 15 // height {0......7......14} +#define am 7 // midpoint { 7 } +#define ar 7 // range {1234567 1234567} enum { - ACC_X = 0, - ACC_Y = 1, - ACC_Z = 2, - ACC_CNT = 3, - ACC_1 = ACC_X, // first - ACC_N = ACC_Z, // last + ACC_X = 0, + ACC_Y = 1, + ACC_Z = 2, + ACC_CNT = 3, + ACC_1 = ACC_X, // first + ACC_N = ACC_Z, // last }; //+============================================================================ -static -void nunchuck_showAcc (Canvas* const canvas, state_t* const state) -{ - ecDecNunchuck_t* d = &state->ec.dec[state->ec.decN].nunchuck; - ecCalNunchuck_t* lo = &state->ec.calS.nunchuck[1]; - ecCalNunchuck_t* mid = &state->ec.calS.nunchuck[2]; - ecCalNunchuck_t* hi = &state->ec.calS.nunchuck[3]; +static void nunchuck_showAcc(Canvas* const canvas, state_t* const state) { + ecDecNunchuck_t* d = &state->ec.dec[state->ec.decN].nunchuck; + ecCalNunchuck_t* lo = &state->ec.calS.nunchuck[1]; + ecCalNunchuck_t* mid = &state->ec.calS.nunchuck[2]; + ecCalNunchuck_t* hi = &state->ec.calS.nunchuck[3]; - int y[ACC_CNT] = {0, 0+(ah+4), 0+((ah+4)*2)}; - int x = 10; + int y[ACC_CNT] = {0, 0 + (ah + 4), 0 + ((ah + 4) * 2)}; + int x = 10; - static uint16_t v[ACC_CNT][aw] = {0}; -// static uint16_t tv[ACC_CNT][aw] = {0}; + static uint16_t v[ACC_CNT][aw] = {0}; + // static uint16_t tv[ACC_CNT][aw] = {0}; - static uint16_t idx = 0; - static uint16_t cnt = aw -1; + static uint16_t idx = 0; + static uint16_t cnt = aw - 1; - // Only record when scanner NOT-paused - if (!state->pause) { - uint16_t dead = (1<<5); + // Only record when scanner NOT-paused + if(!state->pause) { + uint16_t dead = (1 << 5); - // Find axes y-offsets - for (int a = ACC_1; a <= ACC_N; a++) { - uint16_t* dp = NULL; // data value (current reading) - uint16_t* lp = NULL; // lo value - uint16_t* mp = NULL; // mid value - uint16_t* hp = NULL; // hi value - uint16_t* vp = NULL; // value (result) + // Find axes y-offsets + for(int a = ACC_1; a <= ACC_N; a++) { + uint16_t* dp = NULL; // data value (current reading) + uint16_t* lp = NULL; // lo value + uint16_t* mp = NULL; // mid value + uint16_t* hp = NULL; // hi value + uint16_t* vp = NULL; // value (result) - switch (a) { - case ACC_X: - dp = & d->accX; // data (input) - lp = & lo->accX; // low \. - mp = &mid->accX; // mid > calibration - hp = & hi->accX; // high / - vp = &v[ ACC_X][idx]; // value (where to store the result) - break; - case ACC_Y: - dp = & d->accY; - lp = & lo->accY; - mp = &mid->accY; - hp = & hi->accY; - vp = &v[ ACC_Y][idx]; - break; - case ACC_Z: - dp = & d->accZ; - lp = & lo->accZ; - mp = &mid->accZ; - hp = & hi->accZ; - vp = &v[ ACC_Z][idx]; - break; - default: break ; - } + switch(a) { + case ACC_X: + dp = &d->accX; // data (input) + lp = &lo->accX; // low \. + mp = &mid->accX; // mid > calibration + hp = &hi->accX; // high / + vp = &v[ACC_X][idx]; // value (where to store the result) + break; + case ACC_Y: + dp = &d->accY; + lp = &lo->accY; + mp = &mid->accY; + hp = &hi->accY; + vp = &v[ACC_Y][idx]; + break; + case ACC_Z: + dp = &d->accZ; + lp = &lo->accZ; + mp = &mid->accZ; + hp = &hi->accZ; + vp = &v[ACC_Z][idx]; + break; + default: + break; + } - // Again - qv. the joysick calibration: - // This is not the "right way" to do this, it is just "one way" to do it - // ...mid point and extreme zones have a deadzone - // ...the rest is evenly divided by the amount of space on the graph - if ((*dp >= (*mp -dead)) && (*dp <= (*mp +dead))) *vp = ar ; - else if (*dp >= (*hp -dead)) *vp = ah-1 ; - else if (*dp <= (*lp +dead)) *vp = 0 ; - else if (*dp < *mp) { - uint16_t min = ((*lp +dead) +1); - uint16_t max = ((*mp -dead) -1); - float range = (max -min) +1; - float m = range /(ar-1); // 6 evenly(/fairly) divided zones - *vp = ((int)((*dp -min) /m)) +1; + // Again - qv. the joysick calibration: + // This is not the "right way" to do this, it is just "one way" to do it + // ...mid point and extreme zones have a deadzone + // ...the rest is evenly divided by the amount of space on the graph + if((*dp >= (*mp - dead)) && (*dp <= (*mp + dead))) + *vp = ar; + else if(*dp >= (*hp - dead)) + *vp = ah - 1; + else if(*dp <= (*lp + dead)) + *vp = 0; + else if(*dp < *mp) { + uint16_t min = ((*lp + dead) + 1); + uint16_t max = ((*mp - dead) - 1); + float range = (max - min) + 1; + float m = range / (ar - 1); // 6 evenly(/fairly) divided zones + *vp = ((int)((*dp - min) / m)) + 1; - } else {//if (*dp > *mp) - uint16_t min = ((*mp +dead) +1); - uint16_t max = ((*hp -dead) -1); - float range = (max -min) +1; - float m = range /(ar-1); // 6 evenly(/fairly) divided zones - *vp = ((int)((*dp -min) /m)) +1 +ar; - } - } + } else { //if (*dp > *mp) + uint16_t min = ((*mp + dead) + 1); + uint16_t max = ((*hp - dead) - 1); + float range = (max - min) + 1; + float m = range / (ar - 1); // 6 evenly(/fairly) divided zones + *vp = ((int)((*dp - min) / m)) + 1 + ar; + } + } -//! If we decide to offer "export to CSV" -//! I suggest we keep a second array of true-values, rather than do all the maths every time -//! Also - the data will need to me moved to the 'state' table - so a.n.other function can save it off -// tv[ACC_X][idx] = d->accX; -// tv[ACC_Y][idx] = d->accY; -// tv[ACC_Z][idx] = d->accZ; + //! If we decide to offer "export to CSV" + //! I suggest we keep a second array of true-values, rather than do all the maths every time + //! Also - the data will need to me moved to the 'state' table - so a.n.other function can save it off + // tv[ACC_X][idx] = d->accX; + // tv[ACC_Y][idx] = d->accY; + // tv[ACC_Z][idx] = d->accZ; - // Prepare for the next datapoint - if (++idx >= aw) idx = 0 ; - if (cnt) cnt-- ; - } + // Prepare for the next datapoint + if(++idx >= aw) idx = 0; + if(cnt) cnt--; + } - // Auto-pause - if (state->apause && !idx) state->pause = true ; + // Auto-pause + if(state->apause && !idx) state->pause = true; - // *** Draw axes *** - show(canvas, 0,y[ACC_X] +((ah -img_6x8_X.h) /2), &img_6x8_X, SHOW_SET_BLK); - show(canvas, 0,y[ACC_Y] +((ah -img_6x8_Y.h) /2), &img_6x8_Y, SHOW_SET_BLK); - show(canvas, 0,y[ACC_Z] +((ah -img_6x8_Z.h) /2), &img_6x8_Z, SHOW_SET_BLK); + // *** Draw axes *** + show(canvas, 0, y[ACC_X] + ((ah - img_6x8_X.h) / 2), &img_6x8_X, SHOW_SET_BLK); + show(canvas, 0, y[ACC_Y] + ((ah - img_6x8_Y.h) / 2), &img_6x8_Y, SHOW_SET_BLK); + show(canvas, 0, y[ACC_Z] + ((ah - img_6x8_Z.h) / 2), &img_6x8_Z, SHOW_SET_BLK); - canvas_set_color(canvas, ColorBlack); - for (int a = ACC_1; a <= ACC_N; a++) { - canvas_draw_line(canvas, x-1,y[a] , x -1,y[a]+ah); - canvas_draw_line(canvas, x ,y[a]+ah, x+aw-1,y[a]+ah); + canvas_set_color(canvas, ColorBlack); + for(int a = ACC_1; a <= ACC_N; a++) { + canvas_draw_line(canvas, x - 1, y[a], x - 1, y[a] + ah); + canvas_draw_line(canvas, x, y[a] + ah, x + aw - 1, y[a] + ah); - // Mid & Peak lines - for (int i = 1; i < aw; i += 3) { - canvas_draw_dot(canvas, x+i,y[a]); - canvas_draw_dot(canvas, x+i,y[a] +(ah /2)); - } - } + // Mid & Peak lines + for(int i = 1; i < aw; i += 3) { + canvas_draw_dot(canvas, x + i, y[a]); + canvas_draw_dot(canvas, x + i, y[a] + (ah / 2)); + } + } - // Data (wiper display - see notes.txt for scrolling algorithm) - int end = idx ? idx : aw; - for (int a = ACC_1; a <= ACC_N; a++) { - canvas_draw_dot(canvas, x,y[a]+v[a][idx]); - for (int i = 1; i < end; i++) - canvas_draw_line(canvas, x+i,y[a]+v[a][i-1] , x+i,y[a]+v[a][i]); - if (!state->apause) - for (int i = end+10; i < aw -cnt; i++) - canvas_draw_line(canvas, x+i,y[a]+v[a][i-1] , x+i,y[a]+v[a][i]); - } - // Wipe bar - if (end < aw) canvas_draw_line(canvas, x+end,y[0], x+end,y[2]+ah-1); - if (++end < aw) canvas_draw_line(canvas, x+end,y[0], x+end,y[2]+ah-1); - if (++end < aw) canvas_draw_line(canvas, x+end,y[0], x+end,y[2]+ah-1); + // Data (wiper display - see notes.txt for scrolling algorithm) + int end = idx ? idx : aw; + for(int a = ACC_1; a <= ACC_N; a++) { + canvas_draw_dot(canvas, x, y[a] + v[a][idx]); + for(int i = 1; i < end; i++) + canvas_draw_line(canvas, x + i, y[a] + v[a][i - 1], x + i, y[a] + v[a][i]); + if(!state->apause) + for(int i = end + 10; i < aw - cnt; i++) + canvas_draw_line(canvas, x + i, y[a] + v[a][i - 1], x + i, y[a] + v[a][i]); + } + // Wipe bar + if(end < aw) canvas_draw_line(canvas, x + end, y[0], x + end, y[2] + ah - 1); + if(++end < aw) canvas_draw_line(canvas, x + end, y[0], x + end, y[2] + ah - 1); + if(++end < aw) canvas_draw_line(canvas, x + end, y[0], x + end, y[2] + ah - 1); - // *** Mode buttons *** - show(canvas, 0,55, &img_key_L, SHOW_SET_BLK); // mode key + // *** Mode buttons *** + show(canvas, 0, 55, &img_key_L, SHOW_SET_BLK); // mode key - if ((state->calib & CAL_RANGE) || state->pause) state->flash++ ; + if((state->calib & CAL_RANGE) || state->pause) state->flash++; - // -pause- ...yeah, this got a little out of hand! LOL! - if (state->pause || state->apause) { - if (state->pause && state->apause && !idx) { - if (state->flash &8) { - show(canvas, 108,56, &img_key_U, SHOW_SET_BLK); - } else { - show(canvas, 108,56, &img_key_Ui, SHOW_SET_BLK); - canvas_draw_line(canvas, x+aw,y[0], x+aw,y[2]+ah-1); - } - } else { - show(canvas, 108,56, &img_key_Ui, SHOW_SET_BLK); - } - } else { - show(canvas, 108,56, &img_key_U, SHOW_SET_BLK); // pause - } + // -pause- ...yeah, this got a little out of hand! LOL! + if(state->pause || state->apause) { + if(state->pause && state->apause && !idx) { + if(state->flash & 8) { + show(canvas, 108, 56, &img_key_U, SHOW_SET_BLK); + } else { + show(canvas, 108, 56, &img_key_Ui, SHOW_SET_BLK); + canvas_draw_line(canvas, x + aw, y[0], x + aw, y[2] + ah - 1); + } + } else { + show(canvas, 108, 56, &img_key_Ui, SHOW_SET_BLK); + } + } else { + show(canvas, 108, 56, &img_key_U, SHOW_SET_BLK); // pause + } - // -calibration- - if (state->calib & CAL_RANGE) { - show(canvas, 119,55, (state->flash &8) ? &img_key_OKi : &img_key_OK, SHOW_SET_BLK); - } else { - show(canvas, 119,55, &img_key_OK, SHOW_SET_BLK); - } + // -calibration- + if(state->calib & CAL_RANGE) { + show(canvas, 119, 55, (state->flash & 8) ? &img_key_OKi : &img_key_OK, SHOW_SET_BLK); + } else { + show(canvas, 119, 55, &img_key_OK, SHOW_SET_BLK); + } } -# undef aw -# undef ah -# undef am -# undef ar +#undef aw +#undef ah +#undef am +#undef ar //+============================================================================ ======================================== // Default nunchuck screen // -void nunchuck_show (Canvas* const canvas, state_t* const state) -{ - // Nunchucks have TWO scenes - if (state->scene == SCENE_NUNCHUCK_ACC) return nunchuck_showAcc(canvas, state) ; +void nunchuck_show(Canvas* const canvas, state_t* const state) { + // Nunchucks have TWO scenes + if(state->scene == SCENE_NUNCHUCK_ACC) return nunchuck_showAcc(canvas, state); - // Default scene - ecDecNunchuck_t* d = &state->ec.dec[state->ec.decN].nunchuck; - ecCalNunchuck_t* c = (state->hold) ? &state->ec.calS.nunchuck[(state->hold < 0) ? 0 : 4] - : (ecCalNunchuck_t*)d ; //! danger will robinson! - ecCalNunchuck_t* js = state->ec.calS.nunchuck; + // Default scene + ecDecNunchuck_t* d = &state->ec.dec[state->ec.decN].nunchuck; + ecCalNunchuck_t* c = (state->hold) ? &state->ec.calS.nunchuck[(state->hold < 0) ? 0 : 4] : + (ecCalNunchuck_t*)d; //! danger will robinson! + ecCalNunchuck_t* js = state->ec.calS.nunchuck; - // X, Y, Z - show(canvas, 42,0, &img_6x8_X, SHOW_SET_BLK); - show(canvas, 73,0, &img_6x8_Y, SHOW_SET_BLK); - show(canvas, 104,0, &img_6x8_Z, SHOW_SET_BLK); + // X, Y, Z + show(canvas, 42, 0, &img_6x8_X, SHOW_SET_BLK); + show(canvas, 73, 0, &img_6x8_Y, SHOW_SET_BLK); + show(canvas, 104, 0, &img_6x8_Z, SHOW_SET_BLK); - canvas_draw_str_aligned(canvas, 0,14, AlignLeft, AlignTop, "Accel"); - canvas_draw_str_aligned(canvas, 0,28, AlignLeft, AlignTop, "Joy"); + canvas_draw_str_aligned(canvas, 0, 14, AlignLeft, AlignTop, "Accel"); + canvas_draw_str_aligned(canvas, 0, 28, AlignLeft, AlignTop, "Joy"); - // accel values - showHex(canvas, 34,12, c->accX, 3,2); - showHex(canvas, 65,12, c->accY, 3,2); - showHex(canvas, 96,12, c->accZ, 3,2); - // Joy values - showHex(canvas, 38,27, c->joyX, 2,2); - showHex(canvas, 69,27, c->joyY, 2,2); + // accel values + showHex(canvas, 34, 12, c->accX, 3, 2); + showHex(canvas, 65, 12, c->accY, 3, 2); + showHex(canvas, 96, 12, c->accZ, 3, 2); + // Joy values + showHex(canvas, 38, 27, c->joyX, 2, 2); + showHex(canvas, 69, 27, c->joyY, 2, 2); - showJoy(canvas, 103,32, js[1].joyX, js[2].joyX, js[3].joyX, - js[1].joyY, js[2].joyY, js[3].joyY, d->joyX,d->joyY, 8); + showJoy( + canvas, + 103, + 32, + js[1].joyX, + js[2].joyX, + js[3].joyX, + js[1].joyY, + js[2].joyY, + js[3].joyY, + d->joyX, + d->joyY, + 8); - // buttons - canvas_set_color(canvas, ColorBlack); - canvas_draw_str_aligned(canvas, 0,44, AlignLeft, AlignTop, "Button"); + // buttons + canvas_set_color(canvas, ColorBlack); + canvas_draw_str_aligned(canvas, 0, 44, AlignLeft, AlignTop, "Button"); - if (!d->btnC) { - canvas_draw_rframe(canvas, 36,42, 18,12, 6); - show(canvas, 42,44, &img_6x8_C, SHOW_SET_BLK); - } else { - canvas_draw_rbox(canvas, 36,42, 18,12, 6); - show(canvas, 42,44, &img_6x8_C, SHOW_SET_WHT); - canvas_set_color(canvas, ColorBlack); - } + if(!d->btnC) { + canvas_draw_rframe(canvas, 36, 42, 18, 12, 6); + show(canvas, 42, 44, &img_6x8_C, SHOW_SET_BLK); + } else { + canvas_draw_rbox(canvas, 36, 42, 18, 12, 6); + show(canvas, 42, 44, &img_6x8_C, SHOW_SET_WHT); + canvas_set_color(canvas, ColorBlack); + } - if (!d->btnZ) { - canvas_draw_rframe(canvas, 64,40, 24,16, 2); - show(canvas, 73,44, &img_6x8_Z, SHOW_SET_BLK); - } else { - canvas_draw_rbox(canvas, 64,40, 24,16, 2); - show(canvas, 73,44, &img_6x8_Z, SHOW_SET_WHT); - } + if(!d->btnZ) { + canvas_draw_rframe(canvas, 64, 40, 24, 16, 2); + show(canvas, 73, 44, &img_6x8_Z, SHOW_SET_BLK); + } else { + canvas_draw_rbox(canvas, 64, 40, 24, 16, 2); + show(canvas, 73, 44, &img_6x8_Z, SHOW_SET_WHT); + } - // Navigation - showPeakHold(state, canvas, state->hold); // peak keys - show(canvas, 0,55, &img_key_L, SHOW_SET_BLK); // mode keys - show(canvas, 9,55, &img_key_R, SHOW_SET_BLK); + // Navigation + showPeakHold(state, canvas, state->hold); // peak keys + show(canvas, 0, 55, &img_key_L, SHOW_SET_BLK); // mode keys + show(canvas, 9, 55, &img_key_R, SHOW_SET_BLK); } //+============================================================================ ======================================== -static -bool nunchuck_keyAcc (const eventMsg_t* const msg, state_t* const state) -{ - int used = false; // assume key is NOT-handled +static bool nunchuck_keyAcc(const eventMsg_t* const msg, state_t* const state) { + int used = false; // assume key is NOT-handled - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyDown: //# input.type) { + case InputTypeShort: //# input.key) { + case InputKeyDown: //# pause) state->pause = false ; // Paused? Restart - else state->apause = !state->apause ; // No? toggle auto-pause - used = true; - break; + case InputKeyUp: //# pause) + state->pause = false; // Paused? Restart + else + state->apause = !state->apause; // No? toggle auto-pause + used = true; + break; - case InputKeyLeft: //# calib &= ~CAL_NOTJOY; // DO calibrate joystick in NUNCHUCK mode - used = true; - break; + case InputKeyLeft: //# calib &= ~CAL_NOTJOY; // DO calibrate joystick in NUNCHUCK mode + used = true; + break; - default: break ; //# scene == SCENE_NUNCHUCK_ACC) return nunchuck_keyAcc(msg, state) ; +bool nunchuck_key(const eventMsg_t* const msg, state_t* const state) { + // Nunchucks have TWO scenes + if(state->scene == SCENE_NUNCHUCK_ACC) return nunchuck_keyAcc(msg, state); - // Default scene - int used = false; // assume key is NOT-handled + // Default scene + int used = false; // assume key is NOT-handled - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyLeft: //# input.type) { + case InputTypeShort: //# input.key) { + case InputKeyLeft: //# calib |= CAL_NOTJOY; // do NOT calibrate joystick in _ACC mode - used = true; - break; - default: break ; //# calib |= CAL_NOTJOY; // do NOT calibrate joystick in _ACC mode + used = true; + break; + default: + break; //# -#include +#include +#include //----------------------------------------------------------------------------- // Controllers which have calibration must have their calibratable controls here //! Is there a better way to get the start of the decode struct to match the calibration struct ? #define NUNCHUCK_ANALOGUE \ - uint8_t joyX, joyY; \ - uint16_t accX, accY, accZ; + uint8_t joyX, joyY; \ + uint16_t accX, accY, accZ; //----------------------------------------------------------------------------- // Calibratable controls // -typedef - struct ecCalNunchuck { - NUNCHUCK_ANALOGUE - } -ecCalNunchuck_t; +typedef struct ecCalNunchuck { + NUNCHUCK_ANALOGUE +} ecCalNunchuck_t; //----------------------------------------------------------------------------- // All controls // -typedef - struct ecDecNunchuck { - NUNCHUCK_ANALOGUE // MUST be first +typedef struct ecDecNunchuck { + NUNCHUCK_ANALOGUE // MUST be first - // Digital controls - bool btnC, btnZ; // BTN{c, z} - } -ecDecNunchuck_t; + // Digital controls + bool btnC, + btnZ; // BTN{c, z} +} ecDecNunchuck_t; #undef NUNCHUCK_ANALOGUE //============================================================================= // Function prototypes // -#include // Canvas -typedef struct wiiEC wiiEC_t ; -typedef enum ecCalib ecCalib_t ; -typedef struct state state_t ; -typedef struct eventMsg eventMsg_t ; +#include // Canvas +typedef struct wiiEC wiiEC_t; +typedef enum ecCalib ecCalib_t; +typedef struct state state_t; +typedef struct eventMsg eventMsg_t; -void nunchuck_decode (wiiEC_t* const pec) ; -void nunchuck_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) ; -void nunchuck_calib (wiiEC_t* const pec, ecCalib_t c) ; +void nunchuck_decode(wiiEC_t* const pec); +void nunchuck_msg(wiiEC_t* const pec, FuriMessageQueue* const queue); +void nunchuck_calib(wiiEC_t* const pec, ecCalib_t c); -void nunchuck_show (Canvas* const canvas, state_t* const state) ; -bool nunchuck_key (const eventMsg_t* const msg, state_t* const state) ; +void nunchuck_show(Canvas* const canvas, state_t* const state); +bool nunchuck_key(const eventMsg_t* const msg, state_t* const state); #endif //WII_EC_NUNCHUCK_H_ diff --git a/applications/plugins/wii_ec_anal/wii_ec_udraw.c b/applications/plugins/wii_ec_anal/wii_ec_udraw.c index babbc92ab..82987b205 100644 --- a/applications/plugins/wii_ec_anal/wii_ec_udraw.c +++ b/applications/plugins/wii_ec_anal/wii_ec_udraw.c @@ -1,16 +1,16 @@ //! udraw support is NOT written - this is just notes about the init function -#include -#include // Core API +#include +#include // Core API -#include "wii_anal.h" -#include "wii_ec.h" -#include "bc_logging.h" +#include "wii_anal.h" +#include "wii_ec.h" +#include "bc_logging.h" -#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header] +#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header] // ** If you want to see what this source code looks like with all the MACROs expanded // ** grep -v '#include ' wii_ec_udraw.c | gcc -E -o /dev/stdout -xc - -# include "wii_ec_macros.h" +#include "wii_ec_macros.h" //+============================================================================ ======================================== // https://github.com/madhephaestus/WiiChuck/blob/master/src/Drawsome.cpp#L3 @@ -27,13 +27,12 @@ // read 6 bytes starting from 0x00 (#3) // read 6 bytes starting from 0x00 (#4) // -bool udraw_init (wiiEC_t* const pec) -{ - ENTER; - bool rv = true; +bool udraw_init(wiiEC_t* const pec) { + ENTER; + bool rv = true; -(void)pec; -/* + (void)pec; + /* //! this is the Drawsome code, NOT the uDraw code !! static const uint8_t reg[9] = {0x20, 0x28, 0x30, 0x38, 0x00, 0x00, 0xFB, 0x00, 0x00}; // 0..8 const uint8_t* p = reg; @@ -72,74 +71,79 @@ fail: done: */ - LEAVE; - return rv; + LEAVE; + return rv; } //+============================================================================ ======================================== -bool udraw_key (const eventMsg_t* const msg, state_t* const state) -{ -(void)state; - bool run = true; +bool udraw_key(const eventMsg_t* const msg, state_t* const state) { + (void)state; + bool run = true; - switch (msg->input.type) { - case InputTypeShort: //# input.key) { - case InputKeyUp: //# ! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease - switch (msg->input.key) { - case InputKeyUp: //# >U [ LONG-UP ] - case InputKeyDown: //# >D [ LONG-DOWN ] - case InputKeyLeft: //# >L [ LONG-LEFT ] - case InputKeyRight: //# >R [ LONG-RIGHT ] - case InputKeyOk: //# >O [ LONG-OK ] - case InputKeyBack: //# >B [ LONG-BACK ] - default: break ; //# >? - } - break; - case InputTypePress: //# +! After debounce - switch (msg->input.key) { - case InputKeyUp: //# +U [ SHORT-UP ] - case InputKeyDown: //# +D [ SHORT-DOWN ] - case InputKeyLeft: //# +L [ SHORT-LEFT ] - case InputKeyRight: //# +R [ SHORT-RIGHT ] - case InputKeyOk: //# +O [ SHORT-OK ] - case InputKeyBack: //# +B [ SHORT-BACK ] - default: break ; //# +? - } - break; - case InputTypeRepeat: //# *! With INPUT_REPEATE_PRESS period after InputTypeLong event - switch (msg->input.key) { - case InputKeyUp: //# *U [ REPEAT-UP ] - case InputKeyDown: //# *D [ REPEAT-DOWN ] - case InputKeyLeft: //# *L [ REPEAT-LEFT ] - case InputKeyRight: //# *R [ REPEAT-RIGHT ] - case InputKeyOk: //# *O [ REPEAT-OK ] - case InputKeyBack: //# *B [ REPEAT-BACK ] - default: break ; //# *? - } - break; - case InputTypeRelease: //# -! After debounce - switch (msg->input.key) { - case InputKeyUp: //# -U [ RELEASE-UP ] - case InputKeyDown: //# -D [ RELEASE-DOWN ] - case InputKeyLeft: //# -L [ RELEASE-LEFT ] - case InputKeyRight: //# -R [ RELEASE-RIGHT ] - case InputKeyOk: //# -O [ RELEASE-OK ] - case InputKeyBack: //# -B [ RELEASE-BACK ] - default: break ; //# -? - } - break; - default: return true ; - } + switch(msg->input.type) { + case InputTypeShort: //# input.key) { + case InputKeyUp: //# ! After INPUT_LONG_PRESS interval, asynch to InputTypeRelease + switch(msg->input.key) { + case InputKeyUp: //# >U [ LONG-UP ] + case InputKeyDown: //# >D [ LONG-DOWN ] + case InputKeyLeft: //# >L [ LONG-LEFT ] + case InputKeyRight: //# >R [ LONG-RIGHT ] + case InputKeyOk: //# >O [ LONG-OK ] + case InputKeyBack: //# >B [ LONG-BACK ] + default: + break; //# >? + } + break; + case InputTypePress: //# +! After debounce + switch(msg->input.key) { + case InputKeyUp: //# +U [ SHORT-UP ] + case InputKeyDown: //# +D [ SHORT-DOWN ] + case InputKeyLeft: //# +L [ SHORT-LEFT ] + case InputKeyRight: //# +R [ SHORT-RIGHT ] + case InputKeyOk: //# +O [ SHORT-OK ] + case InputKeyBack: //# +B [ SHORT-BACK ] + default: + break; //# +? + } + break; + case InputTypeRepeat: //# *! With INPUT_REPEATE_PRESS period after InputTypeLong event + switch(msg->input.key) { + case InputKeyUp: //# *U [ REPEAT-UP ] + case InputKeyDown: //# *D [ REPEAT-DOWN ] + case InputKeyLeft: //# *L [ REPEAT-LEFT ] + case InputKeyRight: //# *R [ REPEAT-RIGHT ] + case InputKeyOk: //# *O [ REPEAT-OK ] + case InputKeyBack: //# *B [ REPEAT-BACK ] + default: + break; //# *? + } + break; + case InputTypeRelease: //# -! After debounce + switch(msg->input.key) { + case InputKeyUp: //# -U [ RELEASE-UP ] + case InputKeyDown: //# -D [ RELEASE-DOWN ] + case InputKeyLeft: //# -L [ RELEASE-LEFT ] + case InputKeyRight: //# -R [ RELEASE-RIGHT ] + case InputKeyOk: //# -O [ RELEASE-OK ] + case InputKeyBack: //# -B [ RELEASE-BACK ] + default: + break; //# -? + } + break; + default: + return true; + } - return run; + return run; } diff --git a/applications/plugins/wii_ec_anal/wii_ec_udraw.h b/applications/plugins/wii_ec_anal/wii_ec_udraw.h index 1721894e5..9283fd95d 100644 --- a/applications/plugins/wii_ec_anal/wii_ec_udraw.h +++ b/applications/plugins/wii_ec_anal/wii_ec_udraw.h @@ -1,18 +1,18 @@ -#ifndef WII_EC_UDRAW_H_ -#define WII_EC_UDRAW_H_ +#ifndef WII_EC_UDRAW_H_ +#define WII_EC_UDRAW_H_ -#include -#include +#include +#include //============================================================================= ======================================= // Function prototypes // -typedef struct wiiEC wiiEC_t ; -typedef enum ecCalib ecCalib_t ; -typedef struct eventMsg eventMsg_t ; -typedef struct state state_t ; +typedef struct wiiEC wiiEC_t; +typedef enum ecCalib ecCalib_t; +typedef struct eventMsg eventMsg_t; +typedef struct state state_t; -bool udraw_init (wiiEC_t* const pec) ; -bool udraw_key (const eventMsg_t* const msg, state_t* const state) ; +bool udraw_init(wiiEC_t* const pec); +bool udraw_key(const eventMsg_t* const msg, state_t* const state); #endif //WII_EC_UDRAW_H_ diff --git a/applications/plugins/wii_ec_anal/wii_i2c.c b/applications/plugins/wii_ec_anal/wii_i2c.c index 90fe22163..f5d6840d9 100644 --- a/applications/plugins/wii_ec_anal/wii_i2c.c +++ b/applications/plugins/wii_ec_anal/wii_i2c.c @@ -17,103 +17,98 @@ // 0xFA..0xFF ( 6 bytes) ... [r] Perhipheral ID //----------------------------------------------------------------------------- ---------------------------------------- -#include -#include -#include +#include +#include +#include -#include -#include -#include +#include +#include +#include -#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header] +#include "i2c_workaround.h" //! temporary workaround for a bug in furi i2c [see header] -#include "wii_anal.h" -#include "wii_i2c.h" -#include "wii_ec.h" +#include "wii_anal.h" +#include "wii_i2c.h" +#include "wii_ec.h" -#include "bc_logging.h" +#include "bc_logging.h" //----------------------------------------------------------------------------- ---------------------------------------- // Wii Extension Controller i2c Bus address -static const uint8_t ec_i2cAddr = 0x52; +static const uint8_t ec_i2cAddr = 0x52; // Initialise for UNencrypted comms -static const uint8_t regInit1 = 0xF0; -static const uint8_t regInit2 = 0xFB; -static const uint8_t cmdInit1[] = {regInit1, 0x55}; -static const uint8_t cmdInit2[] = {regInit2, 0x00}; +static const uint8_t regInit1 = 0xF0; +static const uint8_t regInit2 = 0xFB; +static const uint8_t cmdInit1[] = {regInit1, 0x55}; +static const uint8_t cmdInit2[] = {regInit2, 0x00}; // Initialise for ENcrypted comms -static const uint8_t regInitEnc = 0x40; -static const uint8_t cmdInitEnc[] = {regInitEnc, 0x00}; +static const uint8_t regInitEnc = 0x40; +static const uint8_t cmdInitEnc[] = {regInitEnc, 0x00}; // Crypto key (PSK), base register : {0x40..0x4F}[2][8] -static const uint8_t regEnc = 0x40; // ENC_LEN +static const uint8_t regEnc = 0x40; // ENC_LEN // Controller State data, base register : {0x00..0x05}[6] -static const uint8_t regJoy = 0x00; // JOY_LEN +static const uint8_t regJoy = 0x00; // JOY_LEN // Calibration data, base register : {0x20..0x2F}[16] -static const uint8_t regCal = 0x20; // CAL_LEN +static const uint8_t regCal = 0x20; // CAL_LEN // Controller ID, base register : {0xFA..0xFF}[6] -static const uint8_t regPid = 0xFA; // PID_LEN +static const uint8_t regPid = 0xFA; // PID_LEN //+============================================================================ ======================================== // Hexdump a buffer to the logfile // #if LOG_LEVEL >= 4 // INFO -static -void dump (const uint8_t* buf, const unsigned int len, const char* id) -{ - // snprintf() would be useful! - char s[128] = {0}; - char* p = NULL; +static void dump(const uint8_t* buf, const unsigned int len, const char* id) { + // snprintf() would be useful! + char s[128] = {0}; + char* p = NULL; - strcpy(s, id); - p = s +strlen(s); - *p++ = ':'; - *p++ = ' '; - *p++ = '{'; + strcpy(s, id); + p = s + strlen(s); + *p++ = ':'; + *p++ = ' '; + *p++ = '{'; - for (unsigned int i = 0; i < len; i++) { - uint8_t hi = (buf[i] &0xF0) >>4; - uint8_t lo = (buf[i] &0x0F); + for(unsigned int i = 0; i < len; i++) { + uint8_t hi = (buf[i] & 0xF0) >> 4; + uint8_t lo = (buf[i] & 0x0F); - hi = hi + ((hi > 9) ? ('A' -10) : '0'); - lo = lo + ((lo > 9) ? ('A' -10) : '0'); + hi = hi + ((hi > 9) ? ('A' - 10) : '0'); + lo = lo + ((lo > 9) ? ('A' - 10) : '0'); - *p++ = (char)hi; - *p++ = (char)lo; - *p++ = ','; - } - *p = '\0'; - *--p = '}'; - INFO(s); + *p++ = (char)hi; + *p++ = (char)lo; + *p++ = ','; + } + *p = '\0'; + *--p = '}'; + INFO(s); } #else -# define dump(...) +#define dump(...) #endif //+============================================================================ ======================================== // //! -W-A-R-N-I-N-G- : THIS ENCRYPTION CODE SHOULD NEVER BE REQUIRED ... AS SUCH, I'VE NEVER TESTED IT // -static -void decrypt (uint8_t* buf, const uint8_t* encKey, const uint8_t reg, unsigned int len) -{ -#if 1 // Use standard algorithm - // decrypted_byte = (encrypted_byte XOR encKey[1][address%8]) + encKey[2][address%8] - for (uint8_t* p = buf; p < buf+len; p++) - *p = (*p ^ encKey[(reg +(p -buf)) %8]) + encKey[8 +((reg +(p -buf)) %8)]; +static void decrypt(uint8_t* buf, const uint8_t* encKey, const uint8_t reg, unsigned int len) { +#if 1 // Use standard algorithm + // decrypted_byte = (encrypted_byte XOR encKey[1][address%8]) + encKey[2][address%8] + for(uint8_t* p = buf; p < buf + len; p++) + *p = (*p ^ encKey[(reg + (p - buf)) % 8]) + encKey[8 + ((reg + (p - buf)) % 8)]; -#else //! This is (I think) a shortcut for an all-zero key [not tested] - (void)encKey; - (void)reg; - for (uint8_t* p = buf; p < buf+len; p++) - *p = (*p ^ 0x17) + 0x17; +#else //! This is (I think) a shortcut for an all-zero key [not tested] + (void)encKey; + (void)reg; + for(uint8_t* p = buf; p < buf + len; p++) *p = (*p ^ 0x17) + 0x17; #endif } @@ -123,38 +118,38 @@ void decrypt (uint8_t* buf, const uint8_t* encKey, const uint8_t reg, unsign // // Returns: {0:OK, >0:Error} // -int ecRead (wiiEC_t* pec) -{ - ENTER; - int rv = 0; // assume success +int ecRead(wiiEC_t* pec) { + ENTER; + int rv = 0; // assume success - if (!pec->init) { - WARN("%s : device not initialised", __func__); - rv = 1; - goto bail; - } + if(!pec->init) { + WARN("%s : device not initialised", __func__); + rv = 1; + goto bail; + } - if (!furi_hal_i2c_is_device_ready(i2cBus,i2cAddr, i2cTimeout)) { - INFO("%s : device disconnected", __func__); - pec->init = false; - rv = 2; - goto bail; - } + if(!furi_hal_i2c_is_device_ready(i2cBus, i2cAddr, i2cTimeout)) { + INFO("%s : device disconnected", __func__); + pec->init = false; + rv = 2; + goto bail; + } - if (!furi_hal_i2c_trxd(i2cBus,i2cAddr, ®Joy,1, pec->joy,JOY_LEN, i2cTimeout,i2cReadWait)) { - ERROR("%s : trxd fail", __func__); - rv = 3; - goto bail; - } + if(!furi_hal_i2c_trxd( + i2cBus, i2cAddr, ®Joy, 1, pec->joy, JOY_LEN, i2cTimeout, i2cReadWait)) { + ERROR("%s : trxd fail", __func__); + rv = 3; + goto bail; + } - if (pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN) ; + if(pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN); - // Decode the readings (according to Controller type) - ecDecode(pec); + // Decode the readings (according to Controller type) + ecDecode(pec); bail: - LEAVE; - return rv; + LEAVE; + return rv; } //+============================================================================ ======================================== @@ -162,148 +157,145 @@ bail: // //! To disable encryption, pass a NULL encryption key <-- this is currently ALWAYS the case // -bool ecInit (wiiEC_t* pec, const uint8_t* encKey) -{ - ENTER; +bool ecInit(wiiEC_t* pec, const uint8_t* encKey) { + ENTER; - bool rv = false; // assume failure + bool rv = false; // assume failure -#if 0 //! i2c workaround +#if 0 //! i2c workaround //! I think this is done during OS startup - long before the plugin starts furi_hal_i2c_init(); #endif -#if 0 //! i2c workaround +#if 0 //! i2c workaround // May become relevant when the i2c issues are resolved // Take control of the i2c bus [which returns void !?] // --> firmware/targets/f7/furi_hal/furi_hal_i2c.c furi_hal_i2c_acquire(i2cBus); #endif - pec->init = false; // assume failure + pec->init = false; // assume failure - // === See if the device is alive === - if (!furi_hal_i2c_is_device_ready(i2cBus,i2cAddr, i2cTimeout)) { - TRACE("%s : waiting for device", __func__); - goto bail; - } - INFO("%s : device connected", __func__); + // === See if the device is alive === + if(!furi_hal_i2c_is_device_ready(i2cBus, i2cAddr, i2cTimeout)) { + TRACE("%s : waiting for device", __func__); + goto bail; + } + INFO("%s : device connected", __func__); - // === Initialise the device === - pec->init = false; // This goes true AFTER the (optional) controller-specific init code + // === Initialise the device === + pec->init = false; // This goes true AFTER the (optional) controller-specific init code - // === Start the Extension Controller === - if (encKey) { //! start in encrypted mode + // === Start the Extension Controller === + if(encKey) { //! start in encrypted mode - //! todo - should this happen here, or AFTER we've got the ID ? + //! todo - should this happen here, or AFTER we've got the ID ? - } else { + } else { + if(!furi_hal_i2c_tx(i2cBus, i2cAddr, cmdInit1, sizeof(cmdInit1), i2cTimeout)) { + ERROR("%s : init fail (dec1)", __func__); + goto bail; + } + TRACE("%s : init OK1", __func__); - if ( !furi_hal_i2c_tx(i2cBus,i2cAddr, cmdInit1,sizeof(cmdInit1), i2cTimeout) ) { - ERROR("%s : init fail (dec1)", __func__); - goto bail; - } - TRACE("%s : init OK1", __func__); + if(!furi_hal_i2c_tx(i2cBus, i2cAddr, cmdInit2, sizeof(cmdInit2), i2cTimeout)) { + ERROR("%s : init fail (dec2)", __func__); + goto bail; + } + TRACE("%s : init OK2", __func__); + } - if ( !furi_hal_i2c_tx(i2cBus,i2cAddr, cmdInit2,sizeof(cmdInit2), i2cTimeout) ) { - ERROR("%s : init fail (dec2)", __func__); - goto bail; - } - TRACE("%s : init OK2", __func__); - } + // === Retrieve the Extension Controller ID === + if(!furi_hal_i2c_trx(i2cBus, i2cAddr, ®Pid, 1, pec->pid, PID_LEN, i2cTimeout)) { + ERROR("%s : T(R)x fail (pid)", __func__); + goto bail; + } + if(pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN); + dump(pec->pid, PID_LEN, "pid"); // debug INFO - // === Retrieve the Extension Controller ID === - if (!furi_hal_i2c_trx(i2cBus,i2cAddr, ®Pid,1, pec->pid,PID_LEN, i2cTimeout)) { - ERROR("%s : T(R)x fail (pid)", __func__); - goto bail; - } - if (pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN); - dump(pec->pid, PID_LEN, "pid"); // debug INFO + // Find the StringID in the lookup table + for(pec->pidx = PID_FIRST; pec->pidx < PID_ERROR; pec->pidx++) + if(memcmp(pec->pid, ecId[pec->pidx].id, PID_LEN) == 0) break; + if(pec->pidx == PID_ERROR) pec->pidx = PID_UNKNOWN; + pec->sid = ecId[pec->pidx].name; + INFO("sid: %s", pec->sid); - // Find the StringID in the lookup table - for (pec->pidx = PID_FIRST; pec->pidx < PID_ERROR; pec->pidx++) - if (memcmp(pec->pid, ecId[pec->pidx].id, PID_LEN) == 0) break ; - if (pec->pidx == PID_ERROR) pec->pidx = PID_UNKNOWN ; - pec->sid = ecId[pec->pidx].name; - INFO("sid: %s", pec->sid); + // === (optionally) Enable encryption === + if(!encKey) { + pec->encrypt = false; - // === (optionally) Enable encryption === - if (!encKey) { - pec->encrypt = false; + } else { // Controller WILL encrypt ALL tranmissions + //! this encryption code fails - should it be done earlier? + //! as it is probably never of any use, I'm kinda loathed to spend time on it + //! https://github.com/madhephaestus/WiiChuck/blob/master/src/Accessory.cpp#L138 + uint8_t encTx[1 + ENC_LEN] = {0}; + uint8_t* ep = encTx; - } else { // Controller WILL encrypt ALL tranmissions -//! this encryption code fails - should it be done earlier? -//! as it is probably never of any use, I'm kinda loathed to spend time on it -//! https://github.com/madhephaestus/WiiChuck/blob/master/src/Accessory.cpp#L138 - uint8_t encTx[1+ENC_LEN] = {0}; - uint8_t* ep = encTx; + pec->encrypt = true; - pec->encrypt = true; + // ** Start the Controller in ENcrytped mode + if(!furi_hal_i2c_tx(i2cBus, i2cAddr, cmdInitEnc, sizeof(cmdInitEnc), i2cTimeout)) { + ERROR("%s : init fail (enc)", __func__); + goto bail; + } - // ** Start the Controller in ENcrytped mode - if ( !furi_hal_i2c_tx(i2cBus,i2cAddr, cmdInitEnc,sizeof(cmdInitEnc), i2cTimeout) ) { - ERROR("%s : init fail (enc)", __func__); - goto bail; - } + // Copy the (symmetric) encryption key to the controller state table + if(pec->encKey != encKey) memcpy(pec->encKey, encKey, ENC_LEN); - // Copy the (symmetric) encryption key to the controller state table - if (pec->encKey != encKey) - memcpy(pec->encKey, encKey, ENC_LEN); + // Build the encryption key packet + *ep++ = regEnc; + memcpy(ep, pec->encKey, ENC_LEN); - // Build the encryption key packet - *ep++ = regEnc; - memcpy(ep, pec->encKey, ENC_LEN); + // ** Send encryption key (PSK) + if(!furi_hal_i2c_tx(i2cBus, i2cAddr, encTx, (1 + ENC_LEN), i2cTimeout)) { + ERROR("%s : key fail", __func__); + goto bail; + } - // ** Send encryption key (PSK) - if ( !furi_hal_i2c_tx(i2cBus,i2cAddr, encTx,(1+ENC_LEN), i2cTimeout) ) { - ERROR("%s : key fail", __func__); - goto bail; - } + TRACE("%s : init OK (enc)", __func__); + } - TRACE("%s : init OK (enc)", __func__); - } + // === Some devices [eg. Drawsome/uDraw] require additional init code === + if(ecId[pec->init].init && (ecId[pec->init].init(pec) == false)) goto bail; + pec->init = true; - // === Some devices [eg. Drawsome/uDraw] require additional init code === - if ( ecId[pec->init].init && (ecId[pec->init].init(pec) == false) ) goto bail ; - pec->init = true; + // === Read calibration data === + if(!furi_hal_i2c_trx(i2cBus, i2cAddr, ®Cal, 1, pec->calF, CAL_LEN, i2cTimeout)) { + ERROR("%s : trx fail (cal)", __func__); + goto bail; + } + if(pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN); + dump(pec->calF, CAL_LEN, "cal"); - // === Read calibration data === - if (!furi_hal_i2c_trx(i2cBus,i2cAddr, ®Cal,1, pec->calF,CAL_LEN, i2cTimeout)) { - ERROR("%s : trx fail (cal)", __func__); - goto bail; - } - if (pec->encrypt) decrypt(pec->joy, pec->encKey, regJoy, JOY_LEN); - dump(pec->calF, CAL_LEN, "cal"); + ecCalibrate(pec, CAL_RESET | CAL_FACTORY); // Load factory default calibration - ecCalibrate(pec, CAL_RESET | CAL_FACTORY); // Load factory default calibration + // === Initialise decode buffers === + pec->decN = 0; // read in to decode[1] (yes, N=0 -> read in to dec[1]) + switch(ecRead(pec)) { + case 0: // read OK + memcpy(&pec->dec[0], &pec->dec[1], sizeof(pec->dec[0])); + dump(pec->joy, JOY_LEN, "joy"); + break; - // === Initialise decode buffers === - pec->decN = 0; // read in to decode[1] (yes, N=0 -> read in to dec[1]) - switch (ecRead(pec)) { - case 0: // read OK - memcpy(&pec->dec[0], &pec->dec[1], sizeof(pec->dec[0])); - dump(pec->joy, JOY_LEN, "joy"); - break; + default: // bug: unknown + case 1: // bug: not initialised - should never happen + ERROR("%s : read bug", __func__); + break; - default: // bug: unknown - case 1: // bug: not initialised - should never happen - ERROR("%s : read bug", __func__); - break; + case 2: // device gone + case 3: // read fail + // Logging done by ecRead() + pec->init = false; + goto bail; + } - case 2: // device gone - case 3: // read fail - // Logging done by ecRead() - pec->init = false; - goto bail; - } - - rv = true; // yay :) + rv = true; // yay :) bail: #if 0 //! i2c workaround furi_hal_i2c_release(i2cBus); #endif - LEAVE; - return rv; + LEAVE; + return rv; } diff --git a/applications/plugins/wii_ec_anal/wii_i2c.h b/applications/plugins/wii_ec_anal/wii_i2c.h index 18cb5ee9b..efebefcf9 100644 --- a/applications/plugins/wii_ec_anal/wii_i2c.h +++ b/applications/plugins/wii_ec_anal/wii_i2c.h @@ -1,7 +1,7 @@ -#ifndef WII_I2C_H_ -#define WII_I2C_H_ +#ifndef WII_I2C_H_ +#define WII_I2C_H_ -#include +#include //#include "wii_ec.h" @@ -14,11 +14,11 @@ // // After the (special) START "bit"... // the first 8bits (byte) of i2c data are the 7bit i2c Address, -// FOLLOWED by 1bit to signify a READ or WRITE {0=write, 1=read} +// FOLLOWED by 1bit to signify a READ or WRITE {0=write, 1=read} // The data is transmitted BIG-Endian, IE. MSb first [human readable] // So the address actually lives in the TOP (MSb's) of the first "byte", (with bit0 being used as the read/write flag) // -// The read() and write() functions on the FZ will set the LSb appropriately, +// The read() and write() functions on the FZ will set the LSb appropriately, // BUT they do NOT shift the address left to make room for it! // So the address you give to read/write() MUST be given as (7bitAddress << 1) // @@ -26,17 +26,17 @@ // // firmware/targets/f7/furi_hal/furi_hal_i2c_types.h -#define i2cBus (&furi_hal_i2c_handle_external) // FZ external i2c bus -#define i2cAddr (ec_i2cAddr << 1) -#define i2cTimeout (3) // in mS -#define i2cReadWait (300) //! 300uS: how low can we take this? +#define i2cBus (&furi_hal_i2c_handle_external) // FZ external i2c bus +#define i2cAddr (ec_i2cAddr << 1) +#define i2cTimeout (3) // in mS +#define i2cReadWait (300) //! 300uS: how low can we take this? //----------------------------------------------------------------------------- ---------------------------------------- // public functions // -typedef struct wiiEC wiiEC_t ; +typedef struct wiiEC wiiEC_t; -bool ecInit (wiiEC_t* const pec, const uint8_t* encKey) ; -int ecRead (wiiEC_t* const pec) ; +bool ecInit(wiiEC_t* const pec, const uint8_t* encKey); +int ecRead(wiiEC_t* const pec); #endif //WII_I2C_H_