Skip to content

Commit df3f01b

Browse files
authored
Merge pull request #22 from jblanked/dev_0.8.1
FlipWorld - v0.8.1 - Improved memory allocation, saving 26 KB. - Added auto-updating (currently uses the catalog API). - Major code refactoring.
2 parents 6d8864e + 42d01dd commit df3f01b

File tree

27 files changed

+1134
-722
lines changed

27 files changed

+1134
-722
lines changed

app.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,25 @@ int32_t flip_world_main(void *p)
4343
while (fhttp->state == INACTIVE && --counter > 0)
4444
{
4545
FURI_LOG_D(TAG, "Waiting for PONG");
46-
furi_delay_ms(100); // this causes a BusFault
46+
furi_delay_ms(100);
4747
}
48-
flipper_http_free(fhttp);
4948

5049
if (counter == 0)
5150
easy_flipper_dialog("FlipperHTTP Error", "Ensure your WiFi Developer\nBoard or Pico W is connected\nand the latest FlipperHTTP\nfirmware is installed.");
5251

5352
// save app version
54-
char app_version[16];
55-
snprintf(app_version, sizeof(app_version), "%f", (double)VERSION);
56-
save_char("app_version", app_version);
53+
// char app_version[16];
54+
// snprintf(app_version, sizeof(app_version), "%f", (double)VERSION);
55+
save_char("app_version", VERSION);
56+
57+
// for now use the catalog API until I implement caching on the server
58+
59+
if (flip_world_handle_app_update(fhttp, true))
60+
{
61+
easy_flipper_dialog("Update Status", "Complete.\nRestart your Flipper Zero.");
62+
}
63+
64+
flipper_http_free(fhttp);
5765

5866
// Run the view dispatcher
5967
view_dispatcher_run(app->view_dispatcher);

application.fam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ App(
1717
),
1818
fap_author="JBlanked",
1919
fap_weburl="https://github.com/jblanked/FlipWorld",
20-
fap_version="0.8",
20+
fap_version="0.8.1",
2121
)

assets/01-home.png

18 Bytes
Loading

assets/CHANGELOG.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
1+
## 0.8.1 (2025-04-09)
2+
- Improved memory allocation, saving 26 KB.
3+
- Added auto-updating (currently uses the catalog API).
4+
- Major code refactoring.
5+
16
## 0.8 (2025-04-05)
27
- Improved memory allocation.
38
- Added multiplayer support.
4-
- Updated the default vibration/sound settings.
9+
- Updated the default settings for vibration and sound.
510

611
## 0.7 (2025-03-21)
712
- Sped up player movement.
8-
- Added a Tutorial mode.
9-
- Fixed transition of worlds.
13+
- Added tutorial mode.
14+
- Fixed issues with transitioning between worlds.
1015

1116
## 0.6.1 (2025-03-15)
12-
- Switched the server backend to prepare for multiplayer in version 0.8.
17+
- Switched the server backend in preparation for multiplayer features introduced in version 0.8.
1318

1419
## 0.6 (2025-03-10)
15-
- Fixed saving of player attributes so that it works as intended.
16-
- Updated the player's level and strength as XP increases.
20+
- Fixed saving of player attributes to ensure they are stored as intended.
21+
- Updated the player's level and strength progression with XP increases.
1722
- Started implementing multiplayer (requires FlipperHTTP v1.7).
1823
- Fixed the display of user stats when switching worlds.
1924

2025
## 0.5 (2025-01-31)
21-
- Fixed saving errors.
26+
- Fixed errors with saving.
2227
- Improved memory allocation.
2328
- Added NPCs.
2429

2530
## 0.4 (2025-01-23)
26-
- Added an In-Game menu.
27-
- Added new controls (HOLD OK to access the In-Game menu, PRESS BACK to exit the menu, and HOLD BACK to leave the game).
28-
- Added option to choose player's weapon in the Game Settings.
29-
- Added transition icon for switching worlds.
31+
- Added an in-game menu.
32+
- Added new controls: hold OK to access the in-game menu, press BACK to exit the menu, and hold BACK to exit the game.
33+
- Added an option to choose the player's weapon in the game settings.
34+
- Added a transition icon for switching worlds.
3035
- Doubled the size of each world (from 384x192 to 768x384).
3136
- Improved memory allocation.
3237

3338
## 0.3 (2025-01-14)
3439
- Added new worlds.
3540
- Improved memory allocation.
36-
- Updated API integration to load and save player attributes.
41+
- Updated API integration for loading and saving player attributes.
3742
- Upgraded FlipperHTTP to the latest version.
3843

3944
## 0.2 (2025-01-02)
40-
- Added support for the Video Game Module (requires a FlipperHTTP flash).
45+
- Added support for the Video Game Module (requires FlipperHTTP flash).
4146
- Introduced various enemy types to enhance gameplay.
4247
- Added features for player health, XP, level, health regeneration, attack, and strength.
4348
- Implemented vibration, sound, and LED notifications when a player is attacking or being attacked.
44-
- Displayed the player's username above their character and showed the player's health, XP, and level in the bottom left corner of the screen at all times.
49+
- Displayed the player's username above the character and continuously showed health, XP, and level in the bottom-left corner of the screen.
4550
- Updated all game icons for improved visual appeal.
4651
- Upgraded to the latest version of the FlipperHTTP library.
47-
- Revised toggles in the Game Settings to ensure they work as intended.
52+
- Revised toggles in the game settings to ensure they work as intended.
4853
- Improved collision mechanics for more accurate interactions.
4954
- Updated the default icon representing the player's character.
5055

callback/alloc.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ bool alloc_message_view(void *context, MessageState state)
1515
switch (state)
1616
{
1717
case MessageStateAbout:
18-
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, message_draw_callback, NULL, callback_to_submenu, &app->view_dispatcher, app);
18+
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, callback_message_draw, NULL, callback_to_submenu, &app->view_dispatcher, app);
1919
break;
2020
case MessageStateLoading:
21-
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, message_draw_callback, NULL, NULL, &app->view_dispatcher, app);
21+
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, callback_message_draw, NULL, NULL, &app->view_dispatcher, app);
2222
break;
2323
case MessageStateWaitingLobby:
24-
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, message_draw_callback, message_input_callback, NULL, &app->view_dispatcher, app);
24+
easy_flipper_set_view(&app->view_message, FlipWorldViewMessage, callback_message_draw, callback_message_input, NULL, &app->view_dispatcher, app);
2525
break;
2626
}
2727
if (!app->view_message)
@@ -67,9 +67,9 @@ bool alloc_text_input_view(void *context, char *title)
6767
title,
6868
app->text_input_temp_buffer,
6969
app->text_input_buffer_size,
70-
is_str(title, "SSID") ? updated_wifi_ssid : is_str(title, "Password") ? updated_wifi_pass
71-
: is_str(title, "Username-Login") ? updated_username
72-
: updated_password,
70+
is_str(title, "SSID") ? callback_updated_wifi_ssid : is_str(title, "Password") ? callback_updated_wifi_pass
71+
: is_str(title, "Username-Login") ? callback_updated_username
72+
: callback_updated_password,
7373
callback_to_wifi_settings,
7474
&app->view_dispatcher,
7575
app))
@@ -109,11 +109,7 @@ bool alloc_text_input_view(void *context, char *title)
109109
bool alloc_variable_item_list(void *context, uint32_t view_id)
110110
{
111111
FlipWorldApp *app = (FlipWorldApp *)context;
112-
if (!app)
113-
{
114-
FURI_LOG_E(TAG, "FlipWorldApp is NULL");
115-
return false;
116-
}
112+
furi_check(app, "FlipWorldApp is NULL");
117113
char ssid[64];
118114
char pass[64];
119115
char username[64];
@@ -123,7 +119,7 @@ bool alloc_variable_item_list(void *context, uint32_t view_id)
123119
switch (view_id)
124120
{
125121
case FlipWorldSubmenuIndexWiFiSettings:
126-
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, wifi_settings_select, callback_to_settings, &app->view_dispatcher, app))
122+
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, callback_wifi_settings_select, callback_to_settings, &app->view_dispatcher, app))
127123
{
128124
FURI_LOG_E(TAG, "Failed to allocate variable item list");
129125
return false;
@@ -156,7 +152,7 @@ bool alloc_variable_item_list(void *context, uint32_t view_id)
156152
}
157153
break;
158154
case FlipWorldSubmenuIndexGameSettings:
159-
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, game_settings_select, callback_to_settings, &app->view_dispatcher, app))
155+
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, callback_game_settings_select, callback_to_settings, &app->view_dispatcher, app))
160156
{
161157
FURI_LOG_E(TAG, "Failed to allocate variable item list");
162158
return false;
@@ -175,43 +171,43 @@ bool alloc_variable_item_list(void *context, uint32_t view_id)
175171
}
176172
if (!app->variable_item_game_player_sprite)
177173
{
178-
app->variable_item_game_player_sprite = variable_item_list_add(app->variable_item_list, "Weapon", 4, player_on_change, NULL);
174+
app->variable_item_game_player_sprite = variable_item_list_add(app->variable_item_list, "Weapon", 4, callback_player_on_change, NULL);
179175
variable_item_set_current_value_index(app->variable_item_game_player_sprite, 1);
180176
variable_item_set_current_value_text(app->variable_item_game_player_sprite, player_sprite_choices[1]);
181177
}
182178
if (!app->variable_item_game_fps)
183179
{
184-
app->variable_item_game_fps = variable_item_list_add(app->variable_item_list, "FPS", 4, fps_change, NULL);
180+
app->variable_item_game_fps = variable_item_list_add(app->variable_item_list, "FPS", 4, callback_fps_change, NULL);
185181
variable_item_set_current_value_index(app->variable_item_game_fps, 0);
186182
variable_item_set_current_value_text(app->variable_item_game_fps, fps_choices_str[0]);
187183
}
188184
if (!app->variable_item_game_vgm_x)
189185
{
190-
app->variable_item_game_vgm_x = variable_item_list_add(app->variable_item_list, "VGM Horizontal", 12, vgm_x_change, NULL);
186+
app->variable_item_game_vgm_x = variable_item_list_add(app->variable_item_list, "VGM Horizontal", 12, callback_vgm_x_change, NULL);
191187
variable_item_set_current_value_index(app->variable_item_game_vgm_x, 2);
192188
variable_item_set_current_value_text(app->variable_item_game_vgm_x, vgm_levels[2]);
193189
}
194190
if (!app->variable_item_game_vgm_y)
195191
{
196-
app->variable_item_game_vgm_y = variable_item_list_add(app->variable_item_list, "VGM Vertical", 12, vgm_y_change, NULL);
192+
app->variable_item_game_vgm_y = variable_item_list_add(app->variable_item_list, "VGM Vertical", 12, callback_vgm_y_change, NULL);
197193
variable_item_set_current_value_index(app->variable_item_game_vgm_y, 2);
198194
variable_item_set_current_value_text(app->variable_item_game_vgm_y, vgm_levels[2]);
199195
}
200196
if (!app->variable_item_game_screen_always_on)
201197
{
202-
app->variable_item_game_screen_always_on = variable_item_list_add(app->variable_item_list, "Keep Screen On?", 2, screen_on_change, NULL);
198+
app->variable_item_game_screen_always_on = variable_item_list_add(app->variable_item_list, "Keep Screen On?", 2, callback_screen_on_change, NULL);
203199
variable_item_set_current_value_index(app->variable_item_game_screen_always_on, 1);
204200
variable_item_set_current_value_text(app->variable_item_game_screen_always_on, yes_or_no_choices[1]);
205201
}
206202
if (!app->variable_item_game_sound_on)
207203
{
208-
app->variable_item_game_sound_on = variable_item_list_add(app->variable_item_list, "Sound On?", 2, sound_on_change, NULL);
204+
app->variable_item_game_sound_on = variable_item_list_add(app->variable_item_list, "Sound On?", 2, callback_sound_on_change, NULL);
209205
variable_item_set_current_value_index(app->variable_item_game_sound_on, 0);
210206
variable_item_set_current_value_text(app->variable_item_game_sound_on, yes_or_no_choices[0]);
211207
}
212208
if (!app->variable_item_game_vibration_on)
213209
{
214-
app->variable_item_game_vibration_on = variable_item_list_add(app->variable_item_list, "Vibration On?", 2, vibration_on_change, NULL);
210+
app->variable_item_game_vibration_on = variable_item_list_add(app->variable_item_list, "Vibration On?", 2, callback_vibration_on_change, NULL);
215211
variable_item_set_current_value_index(app->variable_item_game_vibration_on, 0);
216212
variable_item_set_current_value_text(app->variable_item_game_vibration_on, yes_or_no_choices[0]);
217213
}
@@ -303,7 +299,7 @@ bool alloc_variable_item_list(void *context, uint32_t view_id)
303299
}
304300
break;
305301
case FlipWorldSubmenuIndexUserSettings:
306-
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, user_settings_select, callback_to_settings, &app->view_dispatcher, app))
302+
if (!easy_flipper_set_variable_item_list(&app->variable_item_list, FlipWorldViewVariableItemList, callback_user_settings_select, callback_to_settings, &app->view_dispatcher, app))
307303
{
308304
FURI_LOG_E(TAG, "Failed to allocate variable item list");
309305
return false;

0 commit comments

Comments
 (0)