mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
MNTM: Add flipper Shell Color spoofing support
This commit is contained in:
@@ -2,8 +2,24 @@
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexFlipperName, // TODO: Split into name, mac, serial
|
||||
VarItemListIndexShellColor,
|
||||
};
|
||||
|
||||
const char* const shell_color_names[FuriHalVersionColorCount] = {
|
||||
"Real",
|
||||
"Black",
|
||||
"White",
|
||||
"Transparent",
|
||||
};
|
||||
static void momentum_app_scene_misc_spoof_shell_color_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, shell_color_names[index]);
|
||||
momentum_settings.spoof_color = index;
|
||||
app->save_settings = true;
|
||||
app->require_reboot = true;
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_spoof_var_item_list_callback(void* context, uint32_t index) {
|
||||
MomentumApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
@@ -17,6 +33,15 @@ void momentum_app_scene_misc_spoof_on_enter(void* context) {
|
||||
item = variable_item_list_add(var_item_list, "Flipper Name", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, app->device_name);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Shell Color",
|
||||
FuriHalVersionColorCount,
|
||||
momentum_app_scene_misc_spoof_shell_color_changed,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, momentum_settings.spoof_color);
|
||||
variable_item_set_current_value_text(item, shell_color_names[momentum_settings.spoof_color]);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
var_item_list, momentum_app_scene_misc_spoof_var_item_list_callback, app);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <furi_hal_serial_types.h>
|
||||
#include <furi_hal_version.h>
|
||||
#include <toolbox/colors.h>
|
||||
#include <gui/canvas.h>
|
||||
|
||||
@@ -89,6 +90,7 @@ typedef struct {
|
||||
VgmColorMode vgm_color_mode;
|
||||
Rgb565Color vgm_color_fg;
|
||||
Rgb565Color vgm_color_bg;
|
||||
FuriHalVersionColor spoof_color;
|
||||
} MomentumSettings;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -42,6 +42,7 @@ MomentumSettings momentum_settings = {
|
||||
.vgm_color_mode = VgmColorModeDefault, // Default
|
||||
.vgm_color_fg.value = 0x0000, // Default Black
|
||||
.vgm_color_bg.value = 0xFC00, // Default Orange
|
||||
.spoof_color = FuriHalVersionColorUnknown, // Real
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -112,6 +113,7 @@ static const struct {
|
||||
{setting_enum(vgm_color_mode, VgmColorModeCount)},
|
||||
{setting_uint(vgm_color_fg, 0x0000, 0xFFFF)},
|
||||
{setting_uint(vgm_color_bg, 0x0000, 0xFFFF)},
|
||||
{setting_enum(spoof_color, FuriHalVersionColorCount)},
|
||||
};
|
||||
|
||||
void momentum_settings_load(void) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <stdio.h>
|
||||
#include <ble/ble.h>
|
||||
|
||||
#include <momentum/momentum.h>
|
||||
|
||||
#define TAG "FuriHalVersion"
|
||||
|
||||
#define FURI_HAL_VERSION_OTP_HEADER_MAGIC 0xBABE
|
||||
@@ -241,7 +243,10 @@ uint8_t furi_hal_version_get_hw_body(void) {
|
||||
}
|
||||
|
||||
FuriHalVersionColor furi_hal_version_get_hw_color(void) {
|
||||
return furi_hal_version.board_color;
|
||||
if(momentum_settings.spoof_color == FuriHalVersionColorUnknown) {
|
||||
return furi_hal_version.board_color;
|
||||
}
|
||||
return momentum_settings.spoof_color;
|
||||
}
|
||||
|
||||
uint8_t furi_hal_version_get_hw_connect(void) {
|
||||
|
||||
@@ -35,6 +35,7 @@ typedef enum {
|
||||
FuriHalVersionColorBlack = 0x01,
|
||||
FuriHalVersionColorWhite = 0x02,
|
||||
FuriHalVersionColorTransparent = 0x03,
|
||||
FuriHalVersionColorCount,
|
||||
} FuriHalVersionColor;
|
||||
|
||||
/** Device Regions */
|
||||
|
||||
Reference in New Issue
Block a user