Просмотр исходного кода

Merge pull request #12 from xtruan/develop

Version updates for 1.12
Struan 1 год назад
Родитель
Сommit
ee94a9ade8

+ 1 - 1
application.fam

@@ -14,6 +14,6 @@ App(
     fap_category="Games",
     fap_author="Struan Clark (xtruan)",
     fap_weburl="https://github.com/xtruan/flipper-chess",
-    fap_version=(1, 11),
+    fap_version=(1, 12),
     fap_description="Chess for Flipper",
 )

+ 2 - 2
catalog/manifest.yml

@@ -2,9 +2,9 @@ sourcecode:
   type: git
   location:
     origin: https://github.com/xtruan/flipper-chess.git
-    commit_sha: e5ee4520dfc68080b1723b03f6d8e857ec10a6b0
+    commit_sha: d00c818b652269aff0336adef9ce26c5d94576f4
 description: "How about a nice game of chess?"
-changelog: "v1.11 - Update to support new FW"
+changelog: "v1.12 - Update to fix illegal move bug"
 author: "@xtruan"
 screenshots:
   - "./catalog/startscreen.png"

+ 1 - 1
chess/smallchesslib.h

@@ -3515,4 +3515,4 @@ uint8_t SCL_boardMoveIsLegal(SCL_Board board, uint8_t squareFrom, uint8_t square
     return SCL_squareSetContains(moves, squareTo);
 }
 
-#endif // guard
+#endif // guard

+ 0 - 1
flipchess.c

@@ -64,7 +64,6 @@ FlipChess* flipchess_app_alloc() {
 
     //Scene additions
     app->view_dispatcher = view_dispatcher_alloc();
-    view_dispatcher_enable_queue(app->view_dispatcher);
 
     app->scene_manager = scene_manager_alloc(&flipchess_scene_handlers, app);
     view_dispatcher_set_event_callback_context(app->view_dispatcher, app);

+ 6 - 3
flipchess.h

@@ -16,10 +16,10 @@
 #include "views/flipchess_startscreen.h"
 #include "views/flipchess_scene_1.h"
 
-#define FLIPCHESS_VERSION "v1.11"
+#define FLIPCHESS_VERSION "v1.12"
 
 #define TEXT_BUFFER_SIZE 96
-#define TEXT_SIZE (TEXT_BUFFER_SIZE - 1)
+#define TEXT_SIZE        (TEXT_BUFFER_SIZE - 1)
 
 typedef struct {
     Gui* gui;
@@ -65,7 +65,10 @@ typedef enum {
     FlipChessPlayerAI3 = 3,
 } FlipChessPlayerMode;
 
-typedef enum { FlipChessTextInputDefault, FlipChessTextInputGame } FlipChessTextInputState;
+typedef enum {
+    FlipChessTextInputDefault,
+    FlipChessTextInputGame
+} FlipChessTextInputState;
 
 typedef enum {
     FlipChessStatusNone = 0,

+ 1 - 1
helpers/flipchess_custom_event.h

@@ -13,4 +13,4 @@ typedef enum {
     FlipChessCustomEventScene1Right,
     FlipChessCustomEventScene1Ok,
     FlipChessCustomEventScene1Back,
-} FlipChessCustomEvent;
+} FlipChessCustomEvent;

+ 6 - 6
helpers/flipchess_file.c

@@ -3,15 +3,15 @@
 #include <loader/loader.h>
 
 // #define FLIPCHESS_APP_BASE_FOLDER APP_BOARDA_PATH("flipchess")
-#define FLIPCHESS_APP_BASE_FOLDER EXT_PATH("apps_data/flipchess")
+#define FLIPCHESS_APP_BASE_FOLDER            EXT_PATH("apps_data/flipchess")
 #define FLIPCHESS_APP_BASE_FOLDER_PATH(path) FLIPCHESS_APP_BASE_FOLDER "/" path
-#define FLIPCHESS_BOARD_FILE_NAME "board_fen.txt"
-#define FLIPCHESS_BOARD_FILE_NAME_BAK "board_fen.bak"
-#define FLIPCHESS_BOARD_PATH FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME)
-#define FLIPCHESS_BOARD_PATH_BAK FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME_BAK)
+#define FLIPCHESS_BOARD_FILE_NAME            "board_fen.txt"
+#define FLIPCHESS_BOARD_FILE_NAME_BAK        "board_fen.bak"
+#define FLIPCHESS_BOARD_PATH                 FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME)
+#define FLIPCHESS_BOARD_PATH_BAK             FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME_BAK)
 
 #define FILE_MAX_PATH_LEN 48
-#define FILE_MAX_CHARS 94
+#define FILE_MAX_CHARS    94
 
 bool flipchess_has_file(const FlipChessFile file_type, const char* file_name, const bool remove) {
     bool ret = false;

+ 1 - 1
helpers/flipchess_file.h

@@ -12,4 +12,4 @@ bool flipchess_save_file(
     const FlipChessFile file_type,
     const char* file_name,
     const bool append,
-    const bool overwrite);
+    const bool overwrite);

+ 1 - 1
helpers/flipchess_voice.cpp

@@ -34,4 +34,4 @@ void flipchess_voice_a_strange_game() {
         voice.say("A STRANGE GAME... THE ONLY WINNING MOVE IS NOT TO PLAY.");
         furi_hal_speaker_release();
     }
-}
+}

+ 5 - 3
sam/stm32_sam.cpp

@@ -3304,7 +3304,8 @@ void STM32SAM::AddInflection(unsigned char mem48, unsigned char phase1) {
 
     // FIXME: Explain this fix better, it's not obvious
     // ML : A =, fixes a problem with invalid pitch with '.'
-    while((A = pitches[X]) == 127) X++;
+    while((A = pitches[X]) == 127)
+        X++;
 
 pos48398:
     //48398: CLC
@@ -3787,7 +3788,8 @@ int STM32SAM::Parser1() {
     Y = 0;
 
     // CLEAR THE STRESS TABLE
-    for(i = 0; i < 256; i++) stress[i] = 0;
+    for(i = 0; i < 256; i++)
+        stress[i] = 0;
 
     // THIS CODE MATCHES THE PHONEME LETTERS TO THE TABLE
     // pos41078:
@@ -5628,7 +5630,7 @@ void STM32SAM::setThroat(unsigned char _throat /* = 128 */) {
 #include <math.h>
 #include <stm32wbxx_ll_tim.h>
 
-#define FURI_HAL_SPEAKER_TIMER TIM16
+#define FURI_HAL_SPEAKER_TIMER   TIM16
 #define FURI_HAL_SPEAKER_CHANNEL LL_TIM_CHANNEL_CH1
 
 void STM32SAM::begin(void) {

+ 1 - 1
sam/stm32_sam.h

@@ -93,4 +93,4 @@ private:
 
 }; // STM32SAM class
 
-#endif
+#endif

+ 1 - 1
scenes/flipchess_scene_config.h

@@ -1,4 +1,4 @@
 ADD_SCENE(flipchess, startscreen, Startscreen)
 ADD_SCENE(flipchess, menu, Menu)
 ADD_SCENE(flipchess, scene_1, Scene_1)
-ADD_SCENE(flipchess, settings, Settings)
+ADD_SCENE(flipchess, settings, Settings)

+ 1 - 1
scenes/flipchess_scene_menu.c

@@ -88,4 +88,4 @@ bool flipchess_scene_menu_on_event(void* context, SceneManagerEvent event) {
 void flipchess_scene_menu_on_exit(void* context) {
     FlipChess* app = context;
     submenu_reset(app->submenu);
-}
+}

+ 1 - 1
scenes/flipchess_scene_scene_1.c

@@ -52,4 +52,4 @@ void flipchess_scene_scene_1_on_exit(void* context) {
     if(app->import_game == 1 && strlen(app->import_game_text) > 0) {
         flipchess_save_file(app->import_game_text, FlipChessFileBoard, NULL, false, true);
     }
-}
+}

+ 2 - 2
scenes/flipchess_scene_settings.c

@@ -2,7 +2,7 @@
 #include "../helpers/flipchess_voice.h"
 #include <lib/toolbox/value_index.h>
 
-#define TEXT_LABEL_ON "ON"
+#define TEXT_LABEL_ON  "ON"
 #define TEXT_LABEL_OFF "OFF"
 
 const char* const haptic_text[2] = {
@@ -99,4 +99,4 @@ void flipchess_scene_settings_on_exit(void* context) {
     FlipChess* app = context;
     variable_item_list_set_selected_item(app->variable_item_list, 0);
     variable_item_list_reset(app->variable_item_list);
-}
+}

+ 1 - 1
scenes/flipchess_scene_startscreen.c

@@ -64,4 +64,4 @@ void flipchess_scene_startscreen_on_exit(void* context) {
     if(app->sound == 1) {
         flipchess_voice_shall_we_play();
     }
-}
+}

+ 12 - 15
views/flipchess_scene_1.c

@@ -10,16 +10,16 @@
 #include "../helpers/flipchess_voice.h"
 #include "../helpers/flipchess_haptic.h"
 
-#define SCL_960_CASTLING 0 // setting to 1 compiles a 960 version of smolchess
-#define XBOARD_DEBUG 0 // will create files with xboard communication
+#define SCL_960_CASTLING        0 // setting to 1 compiles a 960 version of smolchess
+#define XBOARD_DEBUG            0 // will create files with xboard communication
 #define SCL_EVALUATION_FUNCTION SCL_boardEvaluateStatic
-#define SCL_DEBUG_AI 0
+#define SCL_DEBUG_AI            0
 
 #include "../chess/smallchesslib.h"
 
-#define ENABLE_960 0 // setting to 1 enables 960 chess
-#define MAX_TEXT_LEN 15 // 15 = max length of text
-#define MAX_TEXT_BUF (MAX_TEXT_LEN + 1) // max length of text + null terminator
+#define ENABLE_960       0 // setting to 1 enables 960 chess
+#define MAX_TEXT_LEN     15 // 15 = max length of text
+#define MAX_TEXT_BUF     (MAX_TEXT_LEN + 1) // max length of text + null terminator
 #define THREAD_WAIT_TIME 20 // time to wait for draw thread to finish
 
 struct FlipChessScene1 {
@@ -231,15 +231,14 @@ uint8_t flipchess_turn(FlipChessScene1Model* model) {
                 // Color check before allowing piece selection
                 char piece = model->game.board[model->squareSelected];
                 if(piece != '.' &&
-                SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
+                   SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
                     model->squareFrom = model->squareSelected;
                     model->turnState = 1;
                 }
             } else if(model->turnState == 1 && model->squareSelected != 255) {
                 // Validate before executing
-                if(SCL_boardMoveIsLegal(model->game.board,
-                                    model->squareFrom,
-                                    model->squareSelected)) {
+                if(SCL_boardMoveIsLegal(
+                       model->game.board, model->squareFrom, model->squareSelected)) {
                     model->squareTo = model->squareSelected;
                     model->turnState = 2;
                     model->squareSelectedLast = model->squareSelected;
@@ -665,8 +664,7 @@ void flipchess_scene_1_exit(void* context) {
     furi_assert(context);
     FlipChessScene1* instance = (FlipChessScene1*)context;
 
-    with_view_model(
-        instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
+    with_view_model(instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
 }
 
 void flipchess_scene_1_enter(void* context) {
@@ -727,8 +725,7 @@ FlipChessScene1* flipchess_scene_1_alloc() {
 void flipchess_scene_1_free(FlipChessScene1* instance) {
     furi_assert(instance);
 
-    with_view_model(
-        instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);
+    with_view_model(instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);
 
     view_free(instance->view);
     free(instance);
@@ -737,4 +734,4 @@ void flipchess_scene_1_free(FlipChessScene1* instance) {
 View* flipchess_scene_1_get_view(FlipChessScene1* instance) {
     furi_assert(instance);
     return instance->view;
-}
+}

+ 1 - 1
views/flipchess_scene_1.h

@@ -16,4 +16,4 @@ View* flipchess_scene_1_get_view(FlipChessScene1* flipchess_static);
 
 FlipChessScene1* flipchess_scene_1_alloc();
 
-void flipchess_scene_1_free(FlipChessScene1* flipchess_static);
+void flipchess_scene_1_free(FlipChessScene1* flipchess_static);

+ 1 - 2
views/flipchess_startscreen.c

@@ -148,8 +148,7 @@ FlipChessStartscreen* flipchess_startscreen_alloc() {
 void flipchess_startscreen_free(FlipChessStartscreen* instance) {
     furi_assert(instance);
 
-    with_view_model(
-        instance->view, FlipChessStartscreenModel * model, { UNUSED(model); }, true);
+    with_view_model(instance->view, FlipChessStartscreenModel * model, { UNUSED(model); }, true);
     view_free(instance->view);
     free(instance);
 }

+ 1 - 1
views/flipchess_startscreen.h

@@ -16,4 +16,4 @@ View* flipchess_startscreen_get_view(FlipChessStartscreen* flipchess_static);
 
 FlipChessStartscreen* flipchess_startscreen_alloc();
 
-void flipchess_startscreen_free(FlipChessStartscreen* flipchess_static);
+void flipchess_startscreen_free(FlipChessStartscreen* flipchess_static);