Skip to content

Commit

Permalink
Latest Release RM0422-0303-0.101.1-442e158 on PATREON & GitHub - SPOO…
Browse files Browse the repository at this point in the history
…F SHELL

By Willy-JL
  • Loading branch information
RogueMaster committed Apr 22, 2024
1 parent fcb200f commit 0ba9124
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
26 changes: 26 additions & 0 deletions applications/settings/cfw_app/scenes/cfw_app_scene_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@ enum VarItemListIndex {
VarItemListIndexVgm,
VarItemListIndexChangeDeviceName,
VarItemListIndexChargeCap,
VarItemListIndexShellColor,
};

const char* const shell_color_names[FuriHalVersionColorCount] = {
"Real",
"Black",
"White",
"Transparent",
};

static void cfw_app_scene_misc_spoof_shell_color_changed(VariableItem* item) {
CfwApp* 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]);
cfw_settings.spoof_color = index;
app->save_settings = true;
app->require_reboot = true;
}

void cfw_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
CfwApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
Expand Down Expand Up @@ -49,6 +66,15 @@ void cfw_app_scene_misc_on_enter(void* context) {
variable_item_set_current_value_index(item, value_index - 1);
variable_item_set_current_value_text(item, cap_str);

item = variable_item_list_add(
var_item_list,
"Shell Color",
FuriHalVersionColorCount,
cfw_app_scene_misc_spoof_shell_color_changed,
app);
variable_item_set_current_value_index(item, cfw_settings.spoof_color);
variable_item_set_current_value_text(item, shell_color_names[cfw_settings.spoof_color]);

variable_item_list_set_enter_callback(
var_item_list, cfw_app_scene_misc_var_item_list_callback, app);

Expand Down
2 changes: 2 additions & 0 deletions lib/cfw/cfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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/icon_i.h>
// #include <power/power_service/power.h>
Expand Down Expand Up @@ -65,6 +66,7 @@ typedef struct {
Rgb565Color vgm_color_bg;
bool rgb_backlight;
uint32_t lcd_style;
FuriHalVersionColor spoof_color;
} CfwSettings;

void CFW_SETTINGS_SAVE(void);
Expand Down
4 changes: 4 additions & 0 deletions lib/cfw/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CfwSettings cfw_settings = {
.vgm_color_mode = VgmColorModeDefault, // Default
.vgm_color_fg.value = 0x0000, // Default Black
.vgm_color_bg.value = 0xFC00, // Default Orange
.spoof_color = FuriHalVersionColorUnknown, // Real
};

void CFW_SETTINGS_LOAD(void) {
Expand Down Expand Up @@ -78,6 +79,8 @@ void CFW_SETTINGS_LOAD(void) {
flipper_format_read_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
flipper_format_rewind(file);
flipper_format_read_uint32(file, "lcd_style", (uint32_t*)&x->lcd_style, 1);
flipper_format_rewind(file);
flipper_format_read_uint32(file, "spoof_color", (uint32_t*)&x->spoof_color, 1);
}
furi_string_free(manifest_name);
flipper_format_free(file);
Expand Down Expand Up @@ -118,6 +121,7 @@ void CFW_SETTINGS_SAVE() {
file, "uart_nmea_channel", (uint32_t*)&x->uart_nmea_channel, 1);
flipper_format_write_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
flipper_format_write_uint32(file, "lcd_style", (uint32_t*)&x->lcd_style, 1);
flipper_format_write_uint32(file, "spoof_color", (uint32_t*)&x->spoof_color, 1);
furi_string_free(manifest_name);
}
flipper_format_free(file);
Expand Down
6 changes: 5 additions & 1 deletion targets/f7/furi_hal/furi_hal_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <stdio.h>
#include <ble/ble.h>
#include <cfw/cfw.h>

#define TAG "FuriHalVersion"

Expand Down Expand Up @@ -251,7 +252,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(cfw_settings.spoof_color == FuriHalVersionColorUnknown) {
return furi_hal_version.board_color;
}
return cfw_settings.spoof_color;
}

uint8_t furi_hal_version_get_hw_connect(void) {
Expand Down
1 change: 1 addition & 0 deletions targets/furi_hal_include/furi_hal_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef enum {
FuriHalVersionColorBlack = 0x01,
FuriHalVersionColorWhite = 0x02,
FuriHalVersionColorTransparent = 0x03,
FuriHalVersionColorCount,
} FuriHalVersionColor;

/** Device Regions */
Expand Down

0 comments on commit 0ba9124

Please sign in to comment.