-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Next-Flip:dev' into dev
- Loading branch information
Showing
32 changed files
with
1,127 additions
and
38 deletions.
There are no files selected for viewing
Submodule external
updated
3 files
+8 −2 | ble_spam/ble_spam.c | |
+ − | video_game_module_tool/files/vgm-fw-rgb.uf2 | |
+10 −0 | video_game_module_tool/scenes/scene_start.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
173 changes: 173 additions & 0 deletions
173
applications/main/momentum_app/scenes/momentum_app_scene_misc_vgm.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
#include "../momentum_app.h" | ||
|
||
enum VarItemListIndex { | ||
VarItemListIndexColors, | ||
VarItemListIndexForeground, | ||
VarItemListIndexBackground, | ||
}; | ||
|
||
void momentum_app_scene_misc_vgm_var_item_list_callback(void* context, uint32_t index) { | ||
MomentumApp* app = context; | ||
view_dispatcher_send_custom_event(app->view_dispatcher, index); | ||
} | ||
|
||
const char* const colors_names[VgmColorModeCount] = { | ||
"Default", | ||
"Custom", | ||
"RGB Backlight", | ||
}; | ||
static void momentum_app_scene_misc_vgm_colors_changed(VariableItem* item) { | ||
MomentumApp* app = variable_item_get_context(item); | ||
uint8_t index = variable_item_get_current_value_index(item); | ||
variable_item_set_current_value_text(item, colors_names[index]); | ||
momentum_settings.vgm_color_mode = index; | ||
app->save_settings = true; | ||
variable_item_set_locked( | ||
variable_item_list_get(app->var_item_list, VarItemListIndexForeground), | ||
index != VgmColorModeCustom, | ||
NULL); | ||
variable_item_set_locked( | ||
variable_item_list_get(app->var_item_list, VarItemListIndexBackground), | ||
index != VgmColorModeCustom, | ||
NULL); | ||
expansion_disable(app->expansion); | ||
expansion_enable(app->expansion); | ||
} | ||
|
||
static const struct { | ||
char* name; | ||
Rgb565Color color; | ||
} vgm_colors[] = { | ||
{"Orange", {0xFC00}}, {"Black", {0x0000}}, {"Red", {0xF800}}, {"Maroon", {0x8000}}, | ||
{"Yellow", {0xFFE0}}, {"Olive", {0x8400}}, {"Lime", {0x07E0}}, {"Green", {0x0400}}, | ||
{"Aqua", {0x07EF}}, {"Cyan", {0x069A}}, {"Azure", {0x03FF}}, {"Teal", {0x0410}}, | ||
{"Blue", {0x001F}}, {"Navy", {0x0010}}, {"Purple", {0x8010}}, {"Fuchsia", {0xF81F}}, | ||
{"Pink", {0xA8F5}}, {"Brown", {0xA145}}, {"White", {0xFFFF}}, | ||
}; | ||
static const size_t vgm_colors_count = COUNT_OF(vgm_colors); | ||
static void momentum_app_scene_misc_vgm_foreground_changed(VariableItem* item) { | ||
MomentumApp* app = variable_item_get_context(item); | ||
uint8_t index = variable_item_get_current_value_index(item); | ||
variable_item_set_current_value_text(item, vgm_colors[index].name); | ||
momentum_settings.vgm_color_fg = vgm_colors[index].color; | ||
app->save_settings = true; | ||
if(momentum_settings.vgm_color_mode == VgmColorModeCustom) { | ||
expansion_disable(app->expansion); | ||
expansion_enable(app->expansion); | ||
} | ||
} | ||
static void momentum_app_scene_misc_vgm_background_changed(VariableItem* item) { | ||
MomentumApp* app = variable_item_get_context(item); | ||
uint8_t index = variable_item_get_current_value_index(item); | ||
variable_item_set_current_value_text(item, vgm_colors[index].name); | ||
momentum_settings.vgm_color_bg = vgm_colors[index].color; | ||
app->save_settings = true; | ||
if(momentum_settings.vgm_color_mode == VgmColorModeCustom) { | ||
expansion_disable(app->expansion); | ||
expansion_enable(app->expansion); | ||
} | ||
} | ||
|
||
void momentum_app_scene_misc_vgm_on_enter(void* context) { | ||
MomentumApp* app = context; | ||
VariableItemList* var_item_list = app->var_item_list; | ||
VariableItem* item; | ||
uint8_t value_index; | ||
|
||
item = variable_item_list_add( | ||
var_item_list, | ||
"VGM Colors", | ||
VgmColorModeCount, | ||
momentum_app_scene_misc_vgm_colors_changed, | ||
app); | ||
value_index = momentum_settings.vgm_color_mode; | ||
variable_item_set_current_value_index(item, value_index); | ||
variable_item_set_current_value_text(item, colors_names[value_index]); | ||
|
||
item = variable_item_list_add( | ||
var_item_list, | ||
"Foreground", | ||
vgm_colors_count, | ||
momentum_app_scene_misc_vgm_foreground_changed, | ||
app); | ||
Rgb565Color color = momentum_settings.vgm_color_fg; | ||
bool found = false; | ||
for(size_t i = 0; i < vgm_colors_count; i++) { | ||
if(rgb565cmp(&color, &vgm_colors[i].color) != 0) continue; | ||
value_index = i; | ||
found = true; | ||
break; | ||
} | ||
variable_item_set_current_value_index(item, found ? value_index : vgm_colors_count); | ||
if(found) { | ||
variable_item_set_current_value_text(item, vgm_colors[value_index].name); | ||
} else { | ||
char str[5]; | ||
snprintf(str, sizeof(str), "%04X", color.value); | ||
variable_item_set_current_value_text(item, str); | ||
} | ||
variable_item_set_locked( | ||
item, momentum_settings.vgm_color_mode != VgmColorModeCustom, "Need Custom\nColors!"); | ||
|
||
item = variable_item_list_add( | ||
var_item_list, | ||
"Background", | ||
vgm_colors_count, | ||
momentum_app_scene_misc_vgm_background_changed, | ||
app); | ||
color = momentum_settings.vgm_color_bg; | ||
found = false; | ||
for(size_t i = 0; i < vgm_colors_count; i++) { | ||
if(rgb565cmp(&color, &vgm_colors[i].color) != 0) continue; | ||
value_index = i; | ||
found = true; | ||
break; | ||
} | ||
variable_item_set_current_value_index(item, found ? value_index : vgm_colors_count); | ||
if(found) { | ||
variable_item_set_current_value_text(item, vgm_colors[value_index].name); | ||
} else { | ||
char str[5]; | ||
snprintf(str, sizeof(str), "%04X", color.value); | ||
variable_item_set_current_value_text(item, str); | ||
} | ||
variable_item_set_locked( | ||
item, momentum_settings.vgm_color_mode != VgmColorModeCustom, "Need Custom\nColors!"); | ||
|
||
variable_item_list_set_enter_callback( | ||
var_item_list, momentum_app_scene_misc_vgm_var_item_list_callback, app); | ||
|
||
variable_item_list_set_selected_item( | ||
var_item_list, scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscVgm)); | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList); | ||
} | ||
|
||
bool momentum_app_scene_misc_vgm_on_event(void* context, SceneManagerEvent event) { | ||
MomentumApp* app = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscVgm, event.event); | ||
consumed = true; | ||
switch(event.event) { | ||
case VarItemListIndexForeground: | ||
case VarItemListIndexBackground: | ||
scene_manager_set_scene_state( | ||
app->scene_manager, | ||
MomentumAppSceneMiscVgmColor, | ||
event.event - VarItemListIndexForeground); | ||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscVgmColor); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void momentum_app_scene_misc_vgm_on_exit(void* context) { | ||
MomentumApp* app = context; | ||
variable_item_list_reset(app->var_item_list); | ||
} |
70 changes: 70 additions & 0 deletions
70
applications/main/momentum_app/scenes/momentum_app_scene_misc_vgm_color.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "../momentum_app.h" | ||
|
||
enum ByteInputResult { | ||
ByteInputResultOk, | ||
}; | ||
|
||
void momentum_app_scene_misc_vgm_color_byte_input_callback(void* context) { | ||
MomentumApp* app = context; | ||
|
||
view_dispatcher_send_custom_event(app->view_dispatcher, ByteInputResultOk); | ||
} | ||
|
||
void momentum_app_scene_misc_vgm_color_on_enter(void* context) { | ||
MomentumApp* app = context; | ||
ByteInput* byte_input = app->byte_input; | ||
|
||
byte_input_set_header_text(byte_input, "Set VGM Color (RGB565)"); | ||
|
||
if(scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscVgmColor)) { | ||
app->vgm_color = momentum_settings.vgm_color_bg; | ||
} else { | ||
app->vgm_color = momentum_settings.vgm_color_fg; | ||
} | ||
app->vgm_color.value = __REVSH(app->vgm_color.value); | ||
|
||
byte_input_set_result_callback( | ||
byte_input, | ||
momentum_app_scene_misc_vgm_color_byte_input_callback, | ||
NULL, | ||
app, | ||
(void*)&app->vgm_color, | ||
sizeof(app->vgm_color)); | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewByteInput); | ||
} | ||
|
||
bool momentum_app_scene_misc_vgm_color_on_event(void* context, SceneManagerEvent event) { | ||
MomentumApp* app = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
consumed = true; | ||
switch(event.event) { | ||
case ByteInputResultOk: | ||
app->vgm_color.value = __REVSH(app->vgm_color.value); | ||
if(scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscVgmColor)) { | ||
momentum_settings.vgm_color_bg = app->vgm_color; | ||
} else { | ||
momentum_settings.vgm_color_fg = app->vgm_color; | ||
} | ||
app->save_settings = true; | ||
if(momentum_settings.vgm_color_mode == VgmColorModeCustom) { | ||
expansion_disable(app->expansion); | ||
expansion_enable(app->expansion); | ||
} | ||
scene_manager_previous_scene(app->scene_manager); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void momentum_app_scene_misc_vgm_color_on_exit(void* context) { | ||
MomentumApp* app = context; | ||
byte_input_set_result_callback(app->byte_input, NULL, NULL, NULL, NULL, 0); | ||
byte_input_set_header_text(app->byte_input, ""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
App( | ||
appid="findmy", | ||
name="FindMy Flipper", | ||
apptype=FlipperAppType.EXTERNAL, | ||
entry_point="findmy_main", | ||
requires=["gui"], | ||
stack_size=1 * 1024, | ||
order=35, | ||
fap_icon="location_icon.png", | ||
fap_category="Bluetooth", | ||
fap_author="@MatthewKuKanich", | ||
fap_version="1.0", | ||
fap_description="BLE FindMy Location Beacon", | ||
) |
Oops, something went wrong.