Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "../momentum_app.h"

#define ONLY_MSG "Only in PS4,\nVertical and\nMNTM styles!"
#define CANT_MSG "Can't show in\nthe selected\nstyle!"

enum VarItemListIndex {
VarItemListIndexMenuStyle,
VarItemListIndexResetMenu,
Expand Down Expand Up @@ -31,6 +34,51 @@ static void momentum_app_scene_interface_mainmenu_menu_style_changed(VariableIte
variable_item_set_current_value_text(item, menu_style_names[index]);
momentum_settings.menu_style = index;
app->save_settings = true;

// Quick and dirty work around to refresh the list to update the locked items,
// and isn't noticeable at all.
scene_manager_previous_scene(app->scene_manager);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceMainmenu);
}

static void momentum_app_scene_interface_mainmenu_name_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.menu_name = value;
app->save_settings = true;
}

static void momentum_app_scene_interface_mainmenu_level_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.menu_level = value;
app->save_settings = true;
}

static void momentum_app_scene_interface_mainmenu_time_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.menu_time = value;
app->save_settings = true;
}

static void momentum_app_scene_interface_mainmenu_battery_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.menu_battery = value;
app->save_settings = true;
}

static void momentum_app_scene_interface_mainmenu_otg_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.menu_otg = value;
app->save_settings = true;
}

static void momentum_app_scene_interface_mainmenu_app_changed(VariableItem* item) {
Expand Down Expand Up @@ -70,6 +118,7 @@ void momentum_app_scene_interface_mainmenu_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
MenuStyle style = momentum_settings.menu_style;

item = variable_item_list_add(
var_item_list,
Expand Down Expand Up @@ -108,6 +157,45 @@ void momentum_app_scene_interface_mainmenu_on_enter(void* context) {

variable_item_list_add(var_item_list, "Remove App", 0, NULL, app);

bool lock_all = style != MenuStylePs4 && style != MenuStyleVertical && style != MenuStyleMNTM;
bool lock_vertical = style == MenuStyleVertical;
bool lock_ps4_vertical = style == MenuStylePs4 || style == MenuStyleVertical;

item = variable_item_list_add(
var_item_list, "Show Name", 2, momentum_app_scene_interface_mainmenu_name_changed, app);
variable_item_set_current_value_index(item, momentum_settings.menu_name);
variable_item_set_current_value_text(item, momentum_settings.menu_name ? "ON" : "OFF");
variable_item_set_locked(item, lock_all || lock_vertical, lock_vertical ? CANT_MSG : ONLY_MSG);

item = variable_item_list_add(
var_item_list, "Show Level", 2, momentum_app_scene_interface_mainmenu_level_changed, app);
variable_item_set_current_value_index(item, momentum_settings.menu_level);
variable_item_set_current_value_text(item, momentum_settings.menu_level ? "ON" : "OFF");
variable_item_set_locked(item, lock_all || lock_vertical, lock_vertical ? CANT_MSG : ONLY_MSG);

item = variable_item_list_add(
var_item_list, "Show Time", 2, momentum_app_scene_interface_mainmenu_time_changed, app);
variable_item_set_current_value_index(item, momentum_settings.menu_time);
variable_item_set_current_value_text(item, momentum_settings.menu_time ? "ON" : "OFF");
variable_item_set_locked(item, lock_all, ONLY_MSG);

item = variable_item_list_add(
var_item_list,
"Show Battery",
2,
momentum_app_scene_interface_mainmenu_battery_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.menu_battery);
variable_item_set_current_value_text(item, momentum_settings.menu_battery ? "ON" : "OFF");
variable_item_set_locked(item, lock_all, ONLY_MSG);

item = variable_item_list_add(
var_item_list, "Show OTG (5v)", 2, momentum_app_scene_interface_mainmenu_otg_changed, app);
variable_item_set_current_value_index(item, momentum_settings.menu_otg);
variable_item_set_current_value_text(item, momentum_settings.menu_otg ? "ON" : "OFF");
variable_item_set_locked(
item, lock_all || lock_ps4_vertical, lock_ps4_vertical ? CANT_MSG : ONLY_MSG);

variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_interface_mainmenu_var_item_list_callback, app);

Expand Down
19 changes: 19 additions & 0 deletions applications/main/momentum_app/scenes/momentum_app_scene_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum VarItemListIndex {
VarItemListIndexSpoof,
VarItemListIndexVgm,
VarItemListIndexChargeCap,
VarItemListIndexMidnightFormat,
VarItemListIndexShowMomentumIntro,
};

Expand All @@ -25,6 +26,14 @@ static void momentum_app_scene_misc_charge_cap_changed(VariableItem* item) {
app->save_settings = true;
}

static void momentum_app_scene_interface_midnight_format_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "00:XX" : "12:XX");
momentum_settings.midnight_format_00 = value;
app->save_settings = true;
}

void momentum_app_scene_misc_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
Expand Down Expand Up @@ -55,6 +64,16 @@ void momentum_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,
"Clock Midnight Format",
2,
momentum_app_scene_interface_midnight_format_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.midnight_format_00);
variable_item_set_current_value_text(
item, momentum_settings.midnight_format_00 ? "00:XX" : "12:XX");

variable_item_list_add(var_item_list, "Show Momentum Intro", 0, NULL, app);

variable_item_list_set_enter_callback(
Expand Down
2 changes: 1 addition & 1 deletion applications/services/desktop/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
hour -= 12;
}
if(hour == 0) {
hour = 12;
hour = momentum_settings.midnight_format_00 ? 0 : 12;
}
}

Expand Down
4 changes: 3 additions & 1 deletion applications/services/desktop/views/desktop_view_locked.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <locale/locale.h>
#include <momentum/momentum.h>

#include "../desktop_i.h"
#include "desktop_view_locked.h"

#define COVER_MOVING_INTERVAL_MS (50)
Expand Down Expand Up @@ -79,6 +78,9 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
} else {
pm = datetime.hour > 12;
snprintf(meridian_str, 3, datetime.hour >= 12 ? "PM" : "AM");
if(datetime.hour == 0) {
datetime.hour = momentum_settings.midnight_format_00 ? 0 : 12;
}
}
snprintf(time_str, 9, "%.2d:%.2d", pm ? datetime.hour - 12 : datetime.hour, datetime.minute);
snprintf(second_str, 5, ":%.2d", datetime.second);
Expand Down
Loading