Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks: Add toggle for the new OC hotkeys #1750

Merged
merged 3 commits into from
Jan 18, 2025
Merged
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
7 changes: 5 additions & 2 deletions src/keymon/keymon.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,18 @@ void turnOffScreen(void)
*/
void cpuClockHotkey(int adjust)
{
if (config_flag_get(".cpuClockHotkey") == 0) {
return;
}
printf_debug("cpuClockHotkey: %d\n", adjust);
int min_cpu_clock = 500; // ?
int max_cpu_clock;
switch (DEVICE_ID) {
case MIYOO354:
max_cpu_clock = 1900;
max_cpu_clock = 1800;
break;
case MIYOO283:
max_cpu_clock = 1700;
max_cpu_clock = 1600;
break;
default:
// Unknown device
Expand Down
5 changes: 5 additions & 0 deletions src/tweaks/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ void action_advancedSetSwapTriggers(void *pt)
stored_value_swap_triggers_changed = true;
}

void action_setCpuClockHotkey(void *pt)
{
config_flag_set(".cpuClockHotkey", ((ListItem *)pt)->value);
}

void action_setAltBrightness(void *pt)
{
config_flag_set(".altBrightness", ((ListItem *)pt)->value);
Expand Down
30 changes: 19 additions & 11 deletions src/tweaks/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,17 @@ void menu_diagnostics(void *pt)
void menu_advanced(void *_)
{
if (!_menu_advanced._created) {
_menu_advanced = list_createWithTitle(7, LIST_SMALL, "Advanced");
_menu_advanced = list_createWithTitle(8, LIST_SMALL, "Advanced");
if (exists(RESET_CONFIGS_PAK)) {
list_addItem(&_menu_advanced,
(ListItem){
.label = "Reset settings...",
.action = menu_resetSettings});
}
list_addItem(&_menu_advanced,
(ListItem){
.label = "Diagnostics...",
.action = menu_diagnostics});
list_addItemWithInfoNote(&_menu_advanced,
(ListItem){
.label = "Swap triggers (L<>L2, R<>R2)",
Expand All @@ -719,6 +729,14 @@ void menu_advanced(void *_)
.action = action_advancedSetSwapTriggers},
"Swap the function of L<>L2 and R<>R2\n"
"(only affects in-game actions).");
list_addItemWithInfoNote(&_menu_advanced,
(ListItem){
.label = "OC hotkeys (SELECT+START+L/R)",
.item_type = TOGGLE,
.value = config_flag_get(".cpuClockHotkey"),
.action = action_setCpuClockHotkey},
"Enable the global hotkeys for\n"
"overclocking the CPU.");
if (DEVICE_ID == MIYOO283) {
list_addItemWithInfoNote(&_menu_advanced,
(ListItem){
Expand Down Expand Up @@ -763,16 +781,6 @@ void menu_advanced(void *_)
"Use this option if you're seeing\n"
"small artifacts on the display.");
}
if (exists(RESET_CONFIGS_PAK)) {
list_addItem(&_menu_advanced,
(ListItem){
.label = "Reset settings...",
.action = menu_resetSettings});
}
list_addItem(&_menu_advanced,
(ListItem){
.label = "Diagnostics...",
.action = menu_diagnostics});
}
menu_stack[++menu_level] = &_menu_advanced;
header_changed = true;
Expand Down
Loading