mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
MNTM: Refactor device name to Spoof submenu
This commit is contained in:
@@ -18,6 +18,7 @@ ADD_SCENE(momentum_app, misc, Misc)
|
||||
ADD_SCENE(momentum_app, misc_screen, MiscScreen)
|
||||
ADD_SCENE(momentum_app, misc_screen_color, MiscScreenColor)
|
||||
ADD_SCENE(momentum_app, misc_dolphin, MiscDolphin)
|
||||
ADD_SCENE(momentum_app, misc_spoof, MiscSpoof)
|
||||
ADD_SCENE(momentum_app, misc_spoof_name, MiscSpoofName)
|
||||
ADD_SCENE(momentum_app, misc_vgm, MiscVgm)
|
||||
ADD_SCENE(momentum_app, misc_vgm_color, MiscVgmColor)
|
||||
ADD_SCENE(momentum_app, misc_rename, MiscRename)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexScreen,
|
||||
VarItemListIndexDolphin,
|
||||
VarItemListIndexSpoof,
|
||||
VarItemListIndexVgm,
|
||||
VarItemListIndexChangeDeviceName,
|
||||
VarItemListIndexChargeCap,
|
||||
VarItemListIndexShowMomentumIntro,
|
||||
};
|
||||
@@ -37,10 +37,11 @@ void momentum_app_scene_misc_on_enter(void* context) {
|
||||
item = variable_item_list_add(var_item_list, "Dolphin", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
item = variable_item_list_add(var_item_list, "VGM Options", 0, NULL, app);
|
||||
item = variable_item_list_add(var_item_list, "Spoofing Options", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
|
||||
item = variable_item_list_add(var_item_list, "VGM Options", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
char cap_str[6];
|
||||
value_index = momentum_settings.charge_cap / CHARGE_CAP_INTV;
|
||||
@@ -81,14 +82,14 @@ bool momentum_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscDolphin, 0);
|
||||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscDolphin);
|
||||
break;
|
||||
case VarItemListIndexSpoof:
|
||||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscSpoof, 0);
|
||||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscSpoof);
|
||||
break;
|
||||
case VarItemListIndexVgm:
|
||||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscVgm, 0);
|
||||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscVgm);
|
||||
break;
|
||||
case VarItemListIndexChangeDeviceName:
|
||||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscRename, 0);
|
||||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscRename);
|
||||
break;
|
||||
case VarItemListIndexShowMomentumIntro: {
|
||||
for(int i = 0; i < 10; i++) {
|
||||
if(storage_common_copy(
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "../momentum_app.h"
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexFlipperName, // TODO: Split into name, mac, serial
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_spoof_on_enter(void* context) {
|
||||
MomentumApp* app = context;
|
||||
VariableItemList* var_item_list = app->var_item_list;
|
||||
VariableItem* item;
|
||||
|
||||
item = variable_item_list_add(var_item_list, "Flipper Name", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, app->device_name);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
var_item_list, momentum_app_scene_misc_spoof_var_item_list_callback, app);
|
||||
|
||||
variable_item_list_set_selected_item(
|
||||
var_item_list,
|
||||
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscSpoof));
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
|
||||
}
|
||||
|
||||
bool momentum_app_scene_misc_spoof_on_event(void* context, SceneManagerEvent event) {
|
||||
MomentumApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscSpoof, event.event);
|
||||
consumed = true;
|
||||
switch(event.event) {
|
||||
case VarItemListIndexFlipperName:
|
||||
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscSpoofName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_spoof_on_exit(void* context) {
|
||||
MomentumApp* app = context;
|
||||
variable_item_list_reset(app->var_item_list);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ enum TextInputIndex {
|
||||
TextInputResultOk,
|
||||
};
|
||||
|
||||
static void momentum_app_scene_misc_rename_text_input_callback(void* context) {
|
||||
static void momentum_app_scene_misc_spoof_name_text_input_callback(void* context) {
|
||||
MomentumApp* app = context;
|
||||
|
||||
app->save_name = true;
|
||||
@@ -12,8 +12,10 @@ static void momentum_app_scene_misc_rename_text_input_callback(void* context) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultOk);
|
||||
}
|
||||
|
||||
static bool
|
||||
momentum_app_scene_misc_rename_validator(const char* text, FuriString* error, void* context) {
|
||||
static bool momentum_app_scene_misc_spoof_name_validator(
|
||||
const char* text,
|
||||
FuriString* error,
|
||||
void* context) {
|
||||
UNUSED(context);
|
||||
|
||||
for(; *text; ++text) {
|
||||
@@ -27,19 +29,19 @@ static bool
|
||||
return true;
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_rename_on_enter(void* context) {
|
||||
void momentum_app_scene_misc_spoof_name_on_enter(void* context) {
|
||||
MomentumApp* app = context;
|
||||
TextInput* text_input = app->text_input;
|
||||
|
||||
text_input_set_header_text(text_input, "Leave empty for default");
|
||||
text_input_set_header_text(text_input, "Leave empty for real name");
|
||||
|
||||
text_input_set_validator(text_input, momentum_app_scene_misc_rename_validator, NULL);
|
||||
text_input_set_validator(text_input, momentum_app_scene_misc_spoof_name_validator, NULL);
|
||||
|
||||
text_input_set_minimum_length(text_input, 0);
|
||||
|
||||
text_input_set_result_callback(
|
||||
text_input,
|
||||
momentum_app_scene_misc_rename_text_input_callback,
|
||||
momentum_app_scene_misc_spoof_name_text_input_callback,
|
||||
app,
|
||||
app->device_name,
|
||||
FURI_HAL_VERSION_ARRAY_NAME_LENGTH,
|
||||
@@ -48,7 +50,7 @@ void momentum_app_scene_misc_rename_on_enter(void* context) {
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewTextInput);
|
||||
}
|
||||
|
||||
bool momentum_app_scene_misc_rename_on_event(void* context, SceneManagerEvent event) {
|
||||
bool momentum_app_scene_misc_spoof_name_on_event(void* context, SceneManagerEvent event) {
|
||||
MomentumApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
@@ -66,7 +68,7 @@ bool momentum_app_scene_misc_rename_on_event(void* context, SceneManagerEvent ev
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_rename_on_exit(void* context) {
|
||||
void momentum_app_scene_misc_spoof_name_on_exit(void* context) {
|
||||
MomentumApp* app = context;
|
||||
text_input_reset(app->text_input);
|
||||
}
|
||||
Reference in New Issue
Block a user