Skip to content

Commit

Permalink
Merge pull request #8 from xtruan/develop
Browse files Browse the repository at this point in the history
Updates for new FW
  • Loading branch information
xtruan authored May 20, 2024
2 parents 8bce552 + 5214970 commit a7d517d
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- develop

env:
firmware_version: '0.86.1'
firmware_version: '0.101.2'

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
firmware_version: '0.86.1'
firmware_version: '0.101.2'

jobs:
build:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/ufbt_build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: "FAP: Build for multiple SDK sources"
name: "uFBT Build"
on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
# push:
# branches:
# - main
# - develop
# pull_request:
# schedule:
# do a build every day
# - cron: "1 1 * * *"
Expand All @@ -21,9 +22,9 @@ jobs:
name: 'ufbt: Build for ${{ matrix.name }}'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build with ufbt
uses: flipperdevices/[email protected].2
uses: flipperdevices/[email protected].3
id: build-app
with:
sdk-channel: ${{ matrix.sdk-channel }}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
![FLIPR](https://github.com/xtruan/flipper-chess/blob/main/icons/FLIPR_128x64.png)

## Chess game for Flipper Zero
- Built against `0.86.1` Flipper Zero firmware release
- Built against `0.101.2` Flipper Zero firmware release
- Uses [smallchesslib](https://codeberg.org/drummyfish/smallchesslib)
- Included in [RogueMaster Custom Firmware](https://github.com/RogueMaster/flipperzero-firmware-wPlugins)

### Installation

Expand Down
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ App(
fap_category="Games",
fap_author="Struan Clark (xtruan)",
fap_weburl="https://github.com/xtruan/flipper-chess",
fap_version=(1, 9),
fap_version=(1, 10),
fap_description="Chess for Flipper",
)
4 changes: 2 additions & 2 deletions catalog/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ sourcecode:
type: git
location:
origin: https://github.com/xtruan/flipper-chess.git
commit_sha: c340eb5ec6a68f9e1213d725002d25812bbe989b
commit_sha: 4678ec9a6db516e09a9c18929dca2a5f1acca32a
description: "How about a nice game of chess?"
changelog: "v1.9.0 - Gameplay enhancements and bug fixes"
changelog: "v1.10 - Update to support new FW"
author: "@xtruan"
screenshots:
- "./catalog/startscreen.png"
Expand Down
11 changes: 7 additions & 4 deletions flipchess.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ FlipChess* flipchess_app_alloc() {
app->view_dispatcher, flipchess_tick_event_callback, 100);
view_dispatcher_set_custom_event_callback(
app->view_dispatcher, flipchess_custom_event_callback);
app->submenu = submenu_alloc();

// Settings
app->haptic = FlipChessHapticOn;
Expand All @@ -89,6 +88,7 @@ FlipChess* flipchess_app_alloc() {
// Text input
app->input_state = FlipChessTextInputDefault;

app->submenu = submenu_alloc();
view_dispatcher_add_view(
app->view_dispatcher, FlipChessViewIdMenu, submenu_get_view(app->submenu));
app->flipchess_startscreen = flipchess_startscreen_alloc();
Expand Down Expand Up @@ -131,14 +131,17 @@ void flipchess_app_free(FlipChess* app) {
// Scene manager
scene_manager_free(app->scene_manager);

text_input_free(app->text_input);

// View Dispatcher
view_dispatcher_remove_view(app->view_dispatcher, FlipChessViewIdMenu);
submenu_free(app->submenu);
view_dispatcher_remove_view(app->view_dispatcher, FlipChessViewIdStartscreen);
flipchess_startscreen_free(app->flipchess_startscreen);
view_dispatcher_remove_view(app->view_dispatcher, FlipChessViewIdScene1);
flipchess_scene_1_free(app->flipchess_scene_1);
view_dispatcher_remove_view(app->view_dispatcher, FlipChessViewIdSettings);
variable_item_list_free(app->variable_item_list);
view_dispatcher_remove_view(app->view_dispatcher, FlipChessViewIdTextInput);
submenu_free(app->submenu);
text_input_free(app->text_input);

view_dispatcher_free(app->view_dispatcher);
furi_record_close(RECORD_GUI);
Expand Down
2 changes: 1 addition & 1 deletion flipchess.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "views/flipchess_startscreen.h"
#include "views/flipchess_scene_1.h"

#define FLIPCHESS_VERSION "v1.9.0"
#define FLIPCHESS_VERSION "v1.10"

#define TEXT_BUFFER_SIZE 96
#define TEXT_SIZE (TEXT_BUFFER_SIZE - 1)
Expand Down
4 changes: 2 additions & 2 deletions helpers/flipchess_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ bool flipchess_has_file(const FlipChessFile file_type, const char* file_name, co
bool flipchess_load_file(char* contents, const FlipChessFile file_type, const char* file_name) {
bool ret = false;
const char* path;
char path_buf[FILE_MAX_PATH_LEN] = {0};
if(file_type == FlipChessFileBoard) {
path = FLIPCHESS_BOARD_PATH;
} else {
char path_buf[FILE_MAX_PATH_LEN] = {0};
strcpy(path_buf, FLIPCHESS_APP_BASE_FOLDER); // 22
strcpy(path_buf + strlen(path_buf), "/");
strcpy(path_buf + strlen(path_buf), file_name);
Expand Down Expand Up @@ -99,11 +99,11 @@ bool flipchess_save_file(
bool ret = false;
const char* path;
const char* path_bak;
char path_buf[FILE_MAX_PATH_LEN] = {0};
if(file_type == FlipChessFileBoard) {
path = FLIPCHESS_BOARD_PATH;
path_bak = FLIPCHESS_BOARD_PATH_BAK;
} else {
char path_buf[FILE_MAX_PATH_LEN] = {0};
strcpy(path_buf, FLIPCHESS_APP_BASE_FOLDER); // 22
strcpy(path_buf + strlen(path_buf), "/");
strcpy(path_buf + strlen(path_buf), file_name);
Expand Down
71 changes: 71 additions & 0 deletions helpers/flipchess_fonts.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include "flipchess_fonts.h"

/*
Fontname: -FreeType-LucasArts SCUMM Subtitle Roman Outline-Medium-R-Normal--32-320-72-72-P-107-ISO10646-1
Copyright: Copyright Goatmeal 2013 LucasArts SCUMM - Subtitle - Roman
Glyphs: 74/95
BBX Build Mode: 0
*/
const uint8_t _u8g2_font_lucasarts_scumm_subtitle_o_tr[1941] U8G2_FONT_SECTION(
"_u8g2_font_lucasarts_scumm_subtitle_o_tr") =
"J\0\3\2\5\4\1\4\6\22\21\0\373\14\374\14\374\1\265\4\345\7x \5\0b\11!\21\246\237"
"\231!\221F\307I\211\232\206\250\323\220\0\42\11\250>\212'\237\206\3'\11\244>\211A\62\15\2,"
"\16\346\222\231A\311\222,\221N\312\20\1-\11in\212\207\34x\10.\11\204\36\211A\222\6\1/"
"\26\253\337zd\7\224XJ\265P\363\37\63\65\222\23\35\330\21\0\60\42\255_\273aHm\322$E"
"\212\224HY\64i\222\224F\66i\312\42%R\244H\232\64U\35\206\14\61\27\250\37\252!\223\42-"
"\12\243)\214\302(\214\302(\214\242C<\34\62\34\253\337\252a\310TE:)\322 I\251$J\242"
"$J\242$J\303\240C\303\3\63\35\253\337\252a\310TE:)\322 I\331\20i\241\70D\303\344"
"\42\235\24U\33\206\10\64\36\253\337\352!\226R-\24\63\251dJ\244)\211\206h\207\206A\222\243\34"
"\210r`H\0\65\35\253\337\212\357\220\64\234r \32\246\34P\206!\222\245A\213,\322IQ\265a"
"\210\0\66\35\253\337\252a\310TE:)\222\64\334\1%\233&E\222\262\310\42\235\24U\33\206\10\67"
"\35\253\337\212\357\320pJ%Q\22%\65\222\243\34\210r \312\201(\7\242\34\30B\0\70\33\253\337"
"\252a\310TE:)\222E:)\252\42\235\24\311\42\235\24U\33\206\10\71\34\253\337\252a\310TE"
":)\222\224E\26\351\226\350\300\223E:)\252\66\14\21\0:\14$#\211A\222\6q\220\244A;"
"\17d\33\211A\222\6q\220\244E\31\24\0\77\36\253\337\252a\310TE:)\322 I\251$J\242"
"\244Fr\224\3C\16D\71\60\204\0A%\257\337\353!\307\244\34\313tD\314\221H\221%)\216\206"
"D\324\221\60\32\26I\12\243D\22\225\261\66\14\341 B\34\253\337\212\203\26KN\321T\232J\246X"
"\212&%J\244$J\244w@\31N\0C\42\254\37\273\341\244&\211\264%\221\42M\231\42\211C\224"
"#\221\16H\341\22)K\42MVq\30\42\0D#\254\37\213\267\34\220\244I\252H\235\224(\222\222"
"(\213\222(\222\222\250\244D\211\224H\223\222\3\322p\3E\36\253\337\212\357\320!J\242A))C"
"\22\25\323\60*F\312\220D\203\62\15\221\16\15\17F\36\253\337\212\357\320!J\242A))C\22\25"
"\323\60*FJ\30\15\231\64\246\341\60\204\0G%\255_\273\341\246&\221\264E\221\42%R\246\224\304"
"%\212\206AR\322)\231\224H\221\42i\313\304(\34.\0H\33\254\37\213\17\241\70\15\221\22\365\247"
"!\252#Q\64D\375\213\64D\243\70<\4I\17\246\237\211C\70)Q\377/\322\70\14\1J\34\252"
"\237\312a,Jj\24Gq\24G\321 %\222\224DS\222UTi\30\42\0K\34\254\37\213\17\241"
"\70]\42[\24\211\241\32\252Q$F\266hR\244!\32\305\341!L\37\254\37\213CZ\225\346(G"
"\242\34\211r$\312\221(G\242p\211\62e\32$\35\33\36\2M\42\257\337\213\333\60\204\212xT\302"
"\61\352\177\322\244\222&\225\226\251\64\14Q\42i\322\230\205\303\220\15\3N#\255_\213\313\60\204I\270"
"\15\221\22N-S\223TR\244\222\324\264D\245\61\221\206lL\302aH\206\1O\42\255_\273aH"
"m\322$E\212\224HY\64i\222\224F\66i\312\42%R\244H\232\64U\35\206\14P\37\253\337\212"
"\247\34P\244I\211\22)\211\22)\211&%\226\242A\213r \212%\65L\207\25Q'\355W\273a"
"Hm\322$E\212\224HY\64i\222\224F\66i\312\42%\32\244HJ\42MU\247\35\320rd\220"
"\0R\35\254\37\213\267\34\220\244I\252H-Ri\222b-\232\244\212\324\213\64D\243\70<\4S\36"
"\253\337\252\341\242&\333$-\246!\31\264!{\310\6e\210\24e\222\266%U\206\23\0T\32\252\237"
"\212\7\35\221J\212\244\14\322\220Eq\24Gq\24G\251$\26\207\11U\37\253\337\212\217\332\64$J"
"T\211Z\242\226\250%j\211Z\242hH\242L\212Tm\30\42\0V\36\253\337\212\217\332\64$JT"
"\211Z\242hH\42\213\26)a\244\204\232\232\305Y<h\0W(\260\37\214\37\304P\233\16\211\22%"
"Q%\252D\225(:$\221\24*Z\24*a\24*\241f\315\264\70\323\342\341\220\1X\42\256\237\213"
"\323\60\204Q\70\271HC\244IVQ\7$\35\20U\311&\15\221\42\231\306(\34\206h\30Y\36\254"
"\37\213\17\241\70\15\221\22\15Q\344\26I\241U\322\201(G\242\34\220\344\60\36\66\0Z\27\253\337\212"
"\357\220\64H\212mH\64\377e\310\24\323 \351\320\360\0_\12\213\336\212\357\220\16\15\17a\33+\337"
"\232a\220d%\32\242d\30\242D\7\222h\210\222h\33\322(\31\16\1b\42\253\337\212A\316b)"
"\7\242\34\210\6-\226\62I\211\206(\211Z\242!J\62I\211\62i\30$\0c\26*\237\252a\210"
"\324!\232,\203\24G\312\60M\211*\15C\2d\37\253\337\332A\316b)\7\242l\220\42\71\221\264"
"$\32\242$j\211\206(\221\64E+\15\7e\26*\237\252a\210\324!\232\244!\322\201i\70M\211"
"*\15C\2f\31\251_\252a\22\225HJ\42\351\260F\322\26\245Q\32\205\222\26f\303\6g\35\253"
"\323\352A\32\264D\35\244\223\42Y\244\313\42.\312\20M\212\244\35\322i\30\42\0h\37\254\37\213A"
"\7\262\34\220r$\312\221h\20\243L\313$)\32\242\376E\32\242Q\34\36\2i\17\206\237\231!\352"
"\64D\375\27i\34\206\0j\34\351S\332!\215\322(\35\322(\215\322(\215\322(\215\322h\30\42\333"
"\252\14C\2k \254\37\213s\30K:\20\345H\64\14Q$F\321\62E\212\30eZ&)\322\20"
"\215\342\360\20l\17\246\237\211A\311\22\251\377_\244q\30\2m\26.\237\213OY\224)Z\251d*"
"\231J\246D\62\215Y\66|n\24+\337\212\247,S\64\251\64\265D-Q\42\35\265\341\1o\26+"
"\337\252a\310TE:)\222\224E\26\351\244\250\332\60D\0p \253\317\212\247,S\64I\211\206("
"\211Z\242!J\62I\211\62)\32\264(\226\324\60\35V\0q!\253\317\252a\220\264(\221\264$\32"
"\242$j\211\206(\221\264H\213\262A\312\201(\226\324\60\35\6r\27+\337\212\207$\13\207PJ\262"
")\211\224!\211bI\15\323a\5s\23)_\232\341\20&\322\244-\353\262I\223\22\16\207\4t\30"
"\210\37\252Q\11\243LZ\322D\232\212Q\30\15I\244$\232\64(\0u\25,\37\213\7%\324\22i"
"\210\372OCT\263\210Y\64\34\2v\25,\37\213\17\241\70\15\221\42\331\42)\264\206\261\244\3C\10"
"w!\62\237\214/\303(&\331\64D\212\223\230$Z$.\241)QC)\211\245!\322\201!\32B"
"\0x\31-_\213\313\60\204I\70D')R\65U\212\244\207\60\11\207!\31\6y\37\215S\213\313"
"\60\204I\70)\312\42\15I(I\251\224\310Z\216D\332\60\205\221\321<\314\0z\24*\237\212\7\35"
"\221.\223\62DC\42-\323\244#\303A\0\0\0\4\377\377\0";
6 changes: 6 additions & 0 deletions helpers/flipchess_fonts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#include <u8g2.h>

extern const uint8_t _u8g2_font_lucasarts_scumm_subtitle_o_tr[] U8G2_FONT_SECTION(
"_u8g2_font_lucasarts_scumm_subtitle_o_tr");
Binary file removed icons/Background_128x11.png
Binary file not shown.
4 changes: 2 additions & 2 deletions sam/stm32_sam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4510,7 +4510,7 @@ void STM32SAM::AdjustLengths() {
mem56 = flags[index];

// not a consonant
if((index != 255 && flags[index] & 64) == 0) {
if((mem56 & 64) == 0) {
// RX or LX?
if((index == 18) || (index == 19)) // 'RX' & 'LX'
{
Expand All @@ -4519,7 +4519,7 @@ void STM32SAM::AdjustLengths() {
index = phonemeindex[X];

// next phoneme a consonant?
if((flags[index] & 64) != 0) {
if((mem56 & 64) != 0) {
// RULE: <VOWEL> RX | LX <CONSONANT>

// decrease length of vowel by 1 frame
Expand Down
11 changes: 4 additions & 7 deletions views/flipchess_startscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <input/input.h>
#include <gui/elements.h>
#include "flipchess_icons.h"
#include "helpers/flipchess_fonts.h"

#include <assets_icons.h>

struct FlipChessStartscreen {
View* view;
Expand Down Expand Up @@ -32,15 +35,9 @@ void flipchess_startscreen_draw(Canvas* canvas, FlipChessStartscreenModel* model

canvas_draw_icon(canvas, 0, 0, &I_FLIPR_128x64);

#ifdef CANVAS_HAS_FONT_SCUMM_ROMAN_OUTLINE
const uint8_t text_x_pos = 2;
const uint8_t text_y_pos = 12;
canvas_set_font(canvas, FontScummRomanOutline);
#else
const uint8_t text_x_pos = 4;
const uint8_t text_y_pos = 11;
canvas_set_font(canvas, FontPrimary);
#endif
canvas_set_custom_u8g2_font(canvas, _u8g2_font_lucasarts_scumm_subtitle_o_tr);
canvas_draw_str(canvas, text_x_pos, text_y_pos, "Chess");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 62, text_y_pos, FLIPCHESS_VERSION);
Expand Down

0 comments on commit a7d517d

Please sign in to comment.