2002-06-27 00:20:00 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-03-25 15:24:03 +00:00
|
|
|
* Copyright (C) 2002 by Stuart Martin
|
2002-07-15 11:02:12 +00:00
|
|
|
* RTC config saving code (C) 2002 by hessu@hes.iki.fi
|
2002-06-27 00:20:00 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-06-27 00:20:00 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include <stdio.h>
|
2004-06-18 20:41:59 +00:00
|
|
|
#include <stddef.h>
|
2007-02-08 04:33:41 +00:00
|
|
|
#include <stdlib.h>
|
2005-02-15 15:30:19 +00:00
|
|
|
#include <limits.h>
|
2006-03-03 01:12:50 +00:00
|
|
|
#include "inttypes.h"
|
2002-06-27 00:20:00 +00:00
|
|
|
#include "config.h"
|
2010-08-01 16:15:27 +00:00
|
|
|
#include "rbpaths.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
#include "action.h"
|
2007-01-23 13:40:44 +00:00
|
|
|
#include "crc32.h"
|
2010-05-15 13:09:45 +00:00
|
|
|
#include "sound.h"
|
2002-06-27 00:20:00 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "debug.h"
|
2002-08-31 04:58:35 +00:00
|
|
|
#include "usb.h"
|
|
|
|
#include "backlight.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2004-03-15 08:27:51 +00:00
|
|
|
#include "talk.h"
|
2010-05-06 21:04:40 +00:00
|
|
|
#include "strlcpy.h"
|
|
|
|
#include "strcasestr.h"
|
2007-01-29 13:44:22 +00:00
|
|
|
#include "rtc.h"
|
2007-01-29 13:58:35 +00:00
|
|
|
#include "power.h"
|
2006-11-08 01:55:26 +00:00
|
|
|
#include "ata_idle_notify.h"
|
2008-11-01 16:14:28 +00:00
|
|
|
#include "storage.h"
|
2002-09-24 17:22:12 +00:00
|
|
|
#include "screens.h"
|
2002-10-02 16:33:26 +00:00
|
|
|
#include "ctype.h"
|
|
|
|
#include "file.h"
|
2002-10-29 12:16:36 +00:00
|
|
|
#include "system.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
#include "general.h"
|
2003-05-04 02:04:31 +00:00
|
|
|
#include "misc.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
#include "icons.h"
|
2002-09-12 13:33:59 +00:00
|
|
|
#include "font.h"
|
2002-10-29 12:09:15 +00:00
|
|
|
#include "peakmeter.h"
|
2002-09-18 14:08:05 +00:00
|
|
|
#include "lang.h"
|
2002-10-08 15:42:40 +00:00
|
|
|
#include "language.h"
|
2002-12-02 16:07:56 +00:00
|
|
|
#include "powermgmt.h"
|
2003-03-10 16:31:02 +00:00
|
|
|
#include "keyboard.h"
|
2003-04-25 10:33:38 +00:00
|
|
|
#include "version.h"
|
2005-12-06 13:27:15 +00:00
|
|
|
#include "rbunicode.h"
|
2005-10-07 17:38:05 +00:00
|
|
|
#include "dircache.h"
|
2005-11-04 17:25:29 +00:00
|
|
|
#include "splash.h"
|
2006-01-22 01:42:05 +00:00
|
|
|
#include "list.h"
|
2007-01-23 13:40:44 +00:00
|
|
|
#include "settings_list.h"
|
2007-06-17 21:29:24 +00:00
|
|
|
#include "filetypes.h"
|
2008-03-25 15:24:03 +00:00
|
|
|
#include "option_select.h"
|
2007-02-18 02:16:03 +00:00
|
|
|
#if CONFIG_TUNER
|
2006-04-02 12:23:08 +00:00
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
2009-08-03 15:06:30 +00:00
|
|
|
#include "wps.h"
|
2009-08-16 18:23:00 +00:00
|
|
|
#include "skin_engine/skin_engine.h"
|
2009-08-16 22:20:11 +00:00
|
|
|
#include "viewport.h"
|
2009-10-19 15:28:15 +00:00
|
|
|
#include "statusbar-skinned.h"
|
2010-04-01 16:27:21 +00:00
|
|
|
#include "bootchart.h"
|
2013-04-03 14:33:23 +00:00
|
|
|
#include "scroll_engine.h"
|
2006-04-02 12:23:08 +00:00
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
struct user_settings global_settings;
|
2007-02-08 10:36:49 +00:00
|
|
|
struct system_status global_status;
|
2007-02-07 04:24:21 +00:00
|
|
|
|
2012-04-29 21:31:30 +00:00
|
|
|
#include "dsp_proc_settings.h"
|
2008-03-28 11:24:24 +00:00
|
|
|
#include "playback.h"
|
2006-11-06 18:07:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
#include "enc_config.h"
|
2005-06-09 09:47:00 +00:00
|
|
|
#endif
|
2013-05-23 17:58:51 +00:00
|
|
|
#include "pcm_sampr.h"
|
2004-09-19 21:58:37 +00:00
|
|
|
|
2015-08-14 15:11:49 +00:00
|
|
|
#define NVRAM_DATA_START 8
|
|
|
|
#ifdef HAVE_RTC_RAM
|
2007-01-23 13:40:44 +00:00
|
|
|
#define NVRAM_BLOCK_SIZE 44
|
2015-08-14 15:11:49 +00:00
|
|
|
#else
|
|
|
|
#define NVRAM_BLOCK_SIZE (sizeof(struct system_status) + NVRAM_DATA_START)
|
|
|
|
#endif
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2002-09-27 09:31:31 +00:00
|
|
|
#define MAX_LINES 10
|
|
|
|
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#include "lcd-remote.h"
|
|
|
|
#endif
|
|
|
|
|
2015-01-30 21:47:30 +00:00
|
|
|
#if defined(DX50) || defined(DX90)
|
|
|
|
#include "governor-ibasso.h"
|
2015-01-21 19:51:36 +00:00
|
|
|
#include "usb-ibasso.h"
|
2015-01-30 21:47:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
long lasttime = 0;
|
|
|
|
|
2007-01-29 13:18:57 +00:00
|
|
|
/** NVRAM stuff, if the target doesnt have NVRAM it is saved in ROCKBOX_DIR /nvram.bin **/
|
2007-01-23 13:40:44 +00:00
|
|
|
/* NVRAM is set out as
|
|
|
|
[0] 'R'
|
|
|
|
[1] 'b'
|
|
|
|
[2] version
|
|
|
|
[3] stored variable count
|
|
|
|
[4-7] crc32 checksum
|
|
|
|
[8-NVRAM_BLOCK_SIZE] data
|
2004-06-18 20:41:59 +00:00
|
|
|
*/
|
2007-01-23 13:40:44 +00:00
|
|
|
static char nvram_buffer[NVRAM_BLOCK_SIZE];
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
static bool read_nvram_data(char* buf, int max_len)
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
2007-01-23 13:40:44 +00:00
|
|
|
unsigned crc32 = 0xffffffff;
|
|
|
|
int var_count = 0, i = 0, buf_pos = 0;
|
|
|
|
#ifndef HAVE_RTC_RAM
|
2010-12-06 22:26:31 +00:00
|
|
|
int fd = open(NVRAM_FILE, O_RDONLY);
|
2010-06-21 12:34:28 +00:00
|
|
|
int bytes;
|
2007-01-23 13:40:44 +00:00
|
|
|
if (fd < 0)
|
|
|
|
return false;
|
|
|
|
memset(buf,0,max_len);
|
2010-06-21 12:34:28 +00:00
|
|
|
bytes = read(fd,buf,max_len);
|
2007-01-23 13:40:44 +00:00
|
|
|
close(fd);
|
2010-06-21 12:34:28 +00:00
|
|
|
if (bytes < 8) /* min is 8 bytes,magic, ver, vars, crc32 */
|
|
|
|
return false;
|
2006-08-12 23:01:52 +00:00
|
|
|
#else
|
2007-01-23 13:40:44 +00:00
|
|
|
memset(buf,0,max_len);
|
|
|
|
/* read rtc block */
|
|
|
|
for (i=0; i < max_len; i++ )
|
|
|
|
buf[i] = rtc_read(0x14+i);
|
|
|
|
#endif
|
|
|
|
/* check magic, version */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if ((buf[0] != 'R') || (buf[1] != 'b')
|
2007-01-23 13:40:44 +00:00
|
|
|
|| (buf[2] != NVRAM_CONFIG_VERSION))
|
|
|
|
return false;
|
|
|
|
/* check crc32 */
|
|
|
|
crc32 = crc_32(&buf[NVRAM_DATA_START],
|
|
|
|
max_len-NVRAM_DATA_START-1,0xffffffff);
|
|
|
|
if (memcmp(&crc32,&buf[4],4))
|
|
|
|
return false;
|
|
|
|
/* all good, so read in the settings */
|
|
|
|
var_count = buf[3];
|
|
|
|
buf_pos = NVRAM_DATA_START;
|
2007-08-12 07:22:38 +00:00
|
|
|
for(i=0; i<nb_settings; i++)
|
2007-01-23 13:40:44 +00:00
|
|
|
{
|
|
|
|
int nvram_bytes = (settings[i].flags&F_NVRAM_BYTES_MASK)
|
|
|
|
>>F_NVRAM_MASK_SHIFT;
|
|
|
|
if (nvram_bytes)
|
|
|
|
{
|
2007-08-12 07:22:38 +00:00
|
|
|
if ((var_count>0) && (buf_pos<max_len))
|
|
|
|
{
|
|
|
|
memcpy(settings[i].setting,&buf[buf_pos],nvram_bytes);
|
|
|
|
buf_pos += nvram_bytes;
|
|
|
|
var_count--;
|
|
|
|
}
|
|
|
|
else /* should only happen when new items are added to the end */
|
|
|
|
{
|
|
|
|
memcpy(settings[i].setting, &settings[i].default_val, nvram_bytes);
|
|
|
|
}
|
2007-01-23 13:40:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2008-03-28 12:51:33 +00:00
|
|
|
static bool write_nvram_data(char* buf, int max_len)
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
2007-01-23 13:40:44 +00:00
|
|
|
unsigned crc32 = 0xffffffff;
|
|
|
|
int i = 0, buf_pos = 0;
|
|
|
|
char var_count = 0;
|
|
|
|
#ifndef HAVE_RTC_RAM
|
|
|
|
int fd;
|
2004-06-18 20:41:59 +00:00
|
|
|
#endif
|
2007-01-23 13:40:44 +00:00
|
|
|
memset(buf,0,max_len);
|
|
|
|
/* magic, version */
|
|
|
|
buf[0] = 'R'; buf[1] = 'b';
|
|
|
|
buf[2] = NVRAM_CONFIG_VERSION;
|
|
|
|
buf_pos = NVRAM_DATA_START;
|
|
|
|
for(i=0; (i<nb_settings) && (buf_pos<max_len); i++)
|
|
|
|
{
|
|
|
|
int nvram_bytes = (settings[i].flags&F_NVRAM_BYTES_MASK)
|
|
|
|
>>F_NVRAM_MASK_SHIFT;
|
|
|
|
if (nvram_bytes)
|
|
|
|
{
|
|
|
|
memcpy(&buf[buf_pos],settings[i].setting,nvram_bytes);
|
|
|
|
buf_pos += nvram_bytes;
|
|
|
|
var_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* count and crc32 */
|
|
|
|
buf[3] = var_count;
|
|
|
|
crc32 = crc_32(&buf[NVRAM_DATA_START],
|
|
|
|
max_len-NVRAM_DATA_START-1,0xffffffff);
|
|
|
|
memcpy(&buf[4],&crc32,4);
|
|
|
|
#ifndef HAVE_RTC_RAM
|
2010-12-06 22:26:31 +00:00
|
|
|
fd = open(NVRAM_FILE,O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
2007-01-23 13:40:44 +00:00
|
|
|
if (fd >= 0)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2007-01-23 13:40:44 +00:00
|
|
|
int len = write(fd,buf,max_len);
|
|
|
|
close(fd);
|
|
|
|
if (len < 8)
|
|
|
|
return false;
|
|
|
|
}
|
2006-05-14 23:34:24 +00:00
|
|
|
#else
|
2007-01-23 13:40:44 +00:00
|
|
|
/* FIXME: okay, it _would_ be cleaner and faster to implement rtc_write so
|
|
|
|
that it would write a number of bytes at a time since the RTC chip
|
|
|
|
supports that, but this will have to do for now 8-) */
|
|
|
|
for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) {
|
|
|
|
int r = rtc_write(0x14+i, buf[i]);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if (r)
|
2007-01-23 13:40:44 +00:00
|
|
|
return false;
|
|
|
|
}
|
2006-11-09 12:27:56 +00:00
|
|
|
#endif
|
2007-01-23 13:40:44 +00:00
|
|
|
return true;
|
2004-06-18 20:41:59 +00:00
|
|
|
}
|
2002-07-15 11:02:12 +00:00
|
|
|
|
2007-01-29 13:18:57 +00:00
|
|
|
/** Reading from a config file **/
|
|
|
|
/*
|
|
|
|
* load settings from disk or RTC RAM
|
|
|
|
*/
|
2008-03-28 12:51:33 +00:00
|
|
|
void settings_load(int which)
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
|
|
|
if (which&SETTINGS_RTC)
|
|
|
|
read_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
|
|
|
|
if (which&SETTINGS_HD)
|
|
|
|
{
|
2010-12-06 22:26:31 +00:00
|
|
|
settings_load_config(CONFIGFILE, false);
|
|
|
|
settings_load_config(FIXEDSETTINGSFILE, false);
|
2007-01-29 13:18:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-01 12:31:03 +00:00
|
|
|
bool cfg_string_to_int(int setting_id, int* out, const char* str)
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
|
|
|
const char* start = settings[setting_id].cfg_vals;
|
|
|
|
char* end = NULL;
|
|
|
|
char temp[MAX_PATH];
|
|
|
|
int count = 0;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
end = strchr(start, ',');
|
|
|
|
if (!end)
|
|
|
|
{
|
|
|
|
if (!strcmp(str, start))
|
|
|
|
{
|
|
|
|
*out = count;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
}
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy(temp, start, end-start+1);
|
2007-01-29 13:18:57 +00:00
|
|
|
if (!strcmp(str, temp))
|
|
|
|
{
|
|
|
|
*out = count;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
start = end +1;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
bool settings_load_config(const char* file, bool apply)
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
char line[128];
|
|
|
|
char* name;
|
|
|
|
char* value;
|
|
|
|
int i;
|
2011-11-28 10:58:15 +00:00
|
|
|
bool theme_changed = false;
|
2008-08-02 20:39:03 +00:00
|
|
|
fd = open_utf8(file, O_RDONLY);
|
2007-01-29 13:18:57 +00:00
|
|
|
if (fd < 0)
|
|
|
|
return false;
|
2008-03-25 12:42:47 +00:00
|
|
|
|
2007-01-29 13:18:57 +00:00
|
|
|
while (read_line(fd, line, sizeof line) > 0)
|
|
|
|
{
|
|
|
|
if (!settings_parseline(line, &name, &value))
|
2011-11-28 10:58:15 +00:00
|
|
|
continue;
|
2007-01-29 13:18:57 +00:00
|
|
|
for(i=0; i<nb_settings; i++)
|
|
|
|
{
|
|
|
|
if (settings[i].cfg_name == NULL)
|
|
|
|
continue;
|
|
|
|
if (!strcasecmp(name,settings[i].cfg_name))
|
|
|
|
{
|
2011-11-28 10:58:15 +00:00
|
|
|
if (settings[i].flags&F_THEMESETTING)
|
|
|
|
theme_changed = true;
|
2007-01-29 13:18:57 +00:00
|
|
|
switch (settings[i].flags&F_T_MASK)
|
|
|
|
{
|
2008-11-03 10:43:37 +00:00
|
|
|
case F_T_CUSTOM:
|
|
|
|
settings[i].custom_setting->load_from_cfg(settings[i].setting, value);
|
|
|
|
break;
|
2007-01-29 13:18:57 +00:00
|
|
|
case F_T_INT:
|
|
|
|
case F_T_UINT:
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
if (settings[i].flags&F_RGB)
|
2008-03-21 13:41:35 +00:00
|
|
|
hex_to_rgb(value, (int*)settings[i].setting);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else
|
|
|
|
#endif
|
2007-01-29 13:18:57 +00:00
|
|
|
if (settings[i].cfg_vals == NULL)
|
|
|
|
{
|
2020-07-27 22:41:02 +00:00
|
|
|
*(int*)settings[i].setting = atoi(value);
|
2007-01-29 13:18:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
int temp, *v = (int*)settings[i].setting;
|
|
|
|
bool found = cfg_string_to_int(i, &temp, value);
|
|
|
|
if (found)
|
|
|
|
{
|
|
|
|
if (settings[i].flags&F_TABLE_SETTING)
|
|
|
|
*v = settings[i].table_setting->values[temp];
|
|
|
|
else
|
|
|
|
*v = temp;
|
|
|
|
}
|
|
|
|
else
|
2009-08-24 16:12:45 +00:00
|
|
|
{ /* atoi breaks choice settings because they
|
|
|
|
* don't have int-like values, and would
|
|
|
|
* fall back to the first value (i.e. 0)
|
|
|
|
* due to atoi */
|
|
|
|
if (!(settings[i].flags&F_CHOICE_SETTING))
|
|
|
|
*v = atoi(value);
|
|
|
|
}
|
2007-01-29 13:18:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case F_T_BOOL:
|
|
|
|
{
|
|
|
|
int temp;
|
|
|
|
if (cfg_string_to_int(i,&temp,value))
|
2009-05-21 14:15:24 +00:00
|
|
|
*(bool*)settings[i].setting = (temp!=0);
|
2008-12-31 05:59:26 +00:00
|
|
|
if (settings[i].bool_setting->option_callback)
|
2009-05-21 14:15:24 +00:00
|
|
|
settings[i].bool_setting->option_callback(temp!=0);
|
2007-01-29 13:18:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case F_T_CHARPTR:
|
|
|
|
case F_T_UCHARPTR:
|
|
|
|
{
|
|
|
|
char storage[MAX_PATH];
|
|
|
|
if (settings[i].filename_setting->prefix)
|
|
|
|
{
|
2010-08-05 14:31:00 +00:00
|
|
|
const char *dir = settings[i].filename_setting->prefix;
|
|
|
|
size_t len = strlen(dir);
|
2010-08-01 16:15:27 +00:00
|
|
|
if (!strncasecmp(value, dir, len))
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy(storage, &value[len], MAX_PATH);
|
2007-01-29 13:18:57 +00:00
|
|
|
}
|
2009-07-14 13:57:45 +00:00
|
|
|
else strlcpy(storage, value, MAX_PATH);
|
2007-01-29 13:18:57 +00:00
|
|
|
}
|
2009-07-14 13:57:45 +00:00
|
|
|
else strlcpy(storage, value, MAX_PATH);
|
2007-01-29 13:18:57 +00:00
|
|
|
if (settings[i].filename_setting->suffix)
|
|
|
|
{
|
|
|
|
char *s = strcasestr(storage,settings[i].filename_setting->suffix);
|
|
|
|
if (s) *s = '\0';
|
|
|
|
}
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy((char*)settings[i].setting, storage,
|
2007-01-29 13:18:57 +00:00
|
|
|
settings[i].filename_setting->max_len);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
} /* if (!strcmp(name,settings[i].cfg_name)) */
|
|
|
|
} /* for(...) */
|
|
|
|
} /* while(...) */
|
|
|
|
|
|
|
|
close(fd);
|
|
|
|
if (apply)
|
2010-02-26 08:01:41 +00:00
|
|
|
{
|
2010-10-03 05:43:36 +00:00
|
|
|
settings_save();
|
2010-03-06 12:14:12 +00:00
|
|
|
settings_apply(true);
|
2011-11-28 10:58:15 +00:00
|
|
|
if (theme_changed)
|
|
|
|
settings_apply_skins();
|
2010-02-26 08:01:41 +00:00
|
|
|
}
|
2007-01-29 13:18:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Writing to a config file and saving settings **/
|
2006-02-26 02:48:05 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
|
2007-01-29 12:32:56 +00:00
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
int flags = settings[setting_id].flags;
|
2007-01-29 12:32:56 +00:00
|
|
|
const char* start = settings[setting_id].cfg_vals;
|
|
|
|
char* end = NULL;
|
|
|
|
int count = 0;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
if ((flags&F_T_MASK)==F_T_INT &&
|
|
|
|
flags&F_TABLE_SETTING)
|
|
|
|
{
|
|
|
|
const int *value = settings[setting_id].table_setting->values;
|
|
|
|
while (start)
|
|
|
|
{
|
|
|
|
end = strchr(start,',');
|
|
|
|
if (value[count] == val)
|
|
|
|
{
|
|
|
|
if (end == NULL)
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy(buf, start, buf_len);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else
|
2007-11-25 17:36:21 +00:00
|
|
|
{
|
2018-11-08 04:29:59 +00:00
|
|
|
int len = MIN(buf_len, (end-start) + 1);
|
|
|
|
strlcpy(buf, start, len);
|
2007-11-25 17:36:21 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
count++;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
if (end)
|
|
|
|
start = end+1;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2007-01-29 12:32:56 +00:00
|
|
|
while (count < val)
|
|
|
|
{
|
|
|
|
start = strchr(start,',');
|
|
|
|
if (!start)
|
|
|
|
return false;
|
|
|
|
count++;
|
|
|
|
start++;
|
|
|
|
}
|
|
|
|
end = strchr(start,',');
|
|
|
|
if (end == NULL)
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy(buf, start, buf_len);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else
|
2007-01-29 12:32:56 +00:00
|
|
|
{
|
2018-11-08 04:29:59 +00:00
|
|
|
int len = MIN(buf_len, (end-start) + 1);
|
|
|
|
strlcpy(buf, start, len);
|
2007-01-29 12:32:56 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2008-03-25 15:24:03 +00:00
|
|
|
|
2008-12-07 16:19:25 +00:00
|
|
|
bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
|
|
|
|
{
|
|
|
|
switch (settings[i].flags&F_T_MASK)
|
|
|
|
{
|
|
|
|
case F_T_CUSTOM:
|
|
|
|
settings[i].custom_setting->write_to_cfg(settings[i].setting,
|
|
|
|
buf, buf_len);
|
|
|
|
break;
|
|
|
|
case F_T_INT:
|
|
|
|
case F_T_UINT:
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
if (settings[i].flags&F_RGB)
|
|
|
|
{
|
|
|
|
int colour = *(int*)settings[i].setting;
|
|
|
|
snprintf(buf,buf_len,"%02x%02x%02x",
|
|
|
|
(int)RGB_UNPACK_RED(colour),
|
|
|
|
(int)RGB_UNPACK_GREEN(colour),
|
|
|
|
(int)RGB_UNPACK_BLUE(colour));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (settings[i].cfg_vals == NULL)
|
|
|
|
{
|
|
|
|
snprintf(buf,buf_len,"%d",*(int*)settings[i].setting);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (cfg_int_to_string(i, *(int*)settings[i].setting,
|
|
|
|
buf, buf_len) == false)
|
|
|
|
{
|
|
|
|
snprintf(buf,buf_len,"%d",*(int*)settings[i].setting);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case F_T_BOOL:
|
|
|
|
cfg_int_to_string(i,
|
|
|
|
*(bool*)settings[i].setting==false?0:1, buf, buf_len);
|
|
|
|
break;
|
|
|
|
case F_T_CHARPTR:
|
|
|
|
case F_T_UCHARPTR:
|
|
|
|
if (((char*)settings[i].setting)[0]
|
|
|
|
&& settings[i].filename_setting->prefix)
|
|
|
|
{
|
2010-02-21 20:34:27 +00:00
|
|
|
if (((char*)settings[i].setting)[0] == '-')
|
|
|
|
{
|
|
|
|
buf[0] = '-';
|
|
|
|
buf[1] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-05 14:31:00 +00:00
|
|
|
snprintf(buf,buf_len,"%s%s%s",
|
|
|
|
settings[i].filename_setting->prefix,
|
2010-02-21 20:34:27 +00:00
|
|
|
(char*)settings[i].setting,
|
|
|
|
settings[i].filename_setting->suffix);
|
|
|
|
}
|
2008-12-07 16:19:25 +00:00
|
|
|
}
|
2018-11-08 04:29:59 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int len = MIN(buf_len, settings[i].filename_setting->max_len);
|
|
|
|
strlcpy(buf,(char*)settings[i].setting,len);
|
|
|
|
}
|
2008-12-07 16:19:25 +00:00
|
|
|
break;
|
|
|
|
} /* switch () */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
static bool is_changed(int setting_id)
|
2007-02-01 13:57:14 +00:00
|
|
|
{
|
2007-02-16 10:20:30 +00:00
|
|
|
const struct settings_list *setting = &settings[setting_id];
|
|
|
|
switch (setting->flags&F_T_MASK)
|
|
|
|
{
|
2008-11-03 10:43:37 +00:00
|
|
|
case F_T_CUSTOM:
|
|
|
|
return setting->custom_setting->is_changed(setting->setting,
|
|
|
|
setting->default_val.custom);
|
|
|
|
break;
|
2007-02-16 10:20:30 +00:00
|
|
|
case F_T_INT:
|
|
|
|
case F_T_UINT:
|
|
|
|
if (setting->flags&F_DEF_ISFUNC)
|
|
|
|
{
|
|
|
|
if (*(int*)setting->setting == setting->default_val.func())
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if (setting->flags&F_T_SOUND)
|
|
|
|
{
|
|
|
|
if (*(int*)setting->setting ==
|
|
|
|
sound_default(setting->sound_setting->setting))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if (*(int*)setting->setting == setting->default_val.int_)
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
case F_T_BOOL:
|
|
|
|
if (*(bool*)setting->setting == setting->default_val.bool_)
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
case F_T_CHARPTR:
|
|
|
|
case F_T_UCHARPTR:
|
|
|
|
if (!strcmp((char*)setting->setting, setting->default_val.charptr))
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
2007-02-01 13:57:14 +00:00
|
|
|
}
|
2007-01-25 07:19:45 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
static bool settings_write_config(const char* filename, int options)
|
2004-09-28 18:09:10 +00:00
|
|
|
{
|
2005-02-11 18:41:40 +00:00
|
|
|
int i;
|
2007-01-23 13:40:44 +00:00
|
|
|
int fd;
|
2007-01-24 03:47:25 +00:00
|
|
|
char value[MAX_PATH];
|
2010-05-06 17:35:13 +00:00
|
|
|
fd = open(filename,O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
2007-01-23 13:40:44 +00:00
|
|
|
if (fd < 0)
|
|
|
|
return false;
|
|
|
|
fdprintf(fd, "# .cfg file created by rockbox %s - "
|
2010-05-27 09:41:46 +00:00
|
|
|
"http://www.rockbox.org\r\n\r\n", rbversion);
|
2007-01-23 13:40:44 +00:00
|
|
|
for(i=0; i<nb_settings; i++)
|
2004-09-28 18:09:10 +00:00
|
|
|
{
|
2007-01-23 13:40:44 +00:00
|
|
|
if (settings[i].cfg_name == NULL)
|
|
|
|
continue;
|
2007-01-29 12:32:56 +00:00
|
|
|
value[0] = '\0';
|
2013-02-05 12:20:17 +00:00
|
|
|
if (settings[i].flags & F_DEPRECATED)
|
|
|
|
continue;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2008-02-23 11:06:19 +00:00
|
|
|
switch (options)
|
|
|
|
{
|
|
|
|
case SETTINGS_SAVE_CHANGED:
|
|
|
|
if (!is_changed(i))
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case SETTINGS_SAVE_SOUND:
|
|
|
|
if ((settings[i].flags&F_SOUNDSETTING) == 0)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case SETTINGS_SAVE_THEME:
|
|
|
|
if ((settings[i].flags&F_THEMESETTING) == 0)
|
|
|
|
continue;
|
|
|
|
break;
|
2007-05-29 04:39:11 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2008-02-23 11:06:19 +00:00
|
|
|
case SETTINGS_SAVE_RECPRESETS:
|
|
|
|
if ((settings[i].flags&F_RECSETTING) == 0)
|
|
|
|
continue;
|
|
|
|
break;
|
2007-12-07 10:59:07 +00:00
|
|
|
#endif
|
2008-02-23 11:06:19 +00:00
|
|
|
case SETTINGS_SAVE_EQPRESET:
|
|
|
|
if ((settings[i].flags&F_EQSETTING) == 0)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
2008-12-07 16:19:25 +00:00
|
|
|
|
|
|
|
cfg_to_string(i, value, MAX_PATH);
|
2008-02-23 10:17:31 +00:00
|
|
|
fdprintf(fd,"%s: %s\r\n",settings[i].cfg_name,value);
|
2007-01-23 13:40:44 +00:00
|
|
|
} /* for(...) */
|
|
|
|
close(fd);
|
|
|
|
return true;
|
|
|
|
}
|
2007-01-24 02:19:22 +00:00
|
|
|
#ifndef HAVE_RTC_RAM
|
2014-03-14 22:15:16 +00:00
|
|
|
static void flush_global_status_callback(void)
|
2007-01-24 02:19:22 +00:00
|
|
|
{
|
2009-10-20 21:54:44 +00:00
|
|
|
write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
|
2007-01-24 02:19:22 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-03-14 22:15:16 +00:00
|
|
|
static void flush_config_block_callback(void)
|
2007-01-23 13:40:44 +00:00
|
|
|
{
|
2009-10-20 21:54:44 +00:00
|
|
|
write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
|
2010-12-06 22:26:31 +00:00
|
|
|
settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED);
|
2004-09-28 18:09:10 +00:00
|
|
|
}
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2016-03-30 22:25:24 +00:00
|
|
|
void reset_runtime(void) {
|
|
|
|
lasttime = current_tick;
|
|
|
|
global_status.runtime = 0;
|
|
|
|
}
|
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2002-07-15 11:02:12 +00:00
|
|
|
* persist all runtime user settings to disk or RTC RAM
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2007-01-24 02:19:22 +00:00
|
|
|
static void update_runtime(void)
|
2002-06-27 00:20:00 +00:00
|
|
|
{
|
2007-01-23 13:40:44 +00:00
|
|
|
int elapsed_secs;
|
2006-04-02 12:23:08 +00:00
|
|
|
|
2007-01-23 13:40:44 +00:00
|
|
|
elapsed_secs = (current_tick - lasttime) / HZ;
|
2007-01-24 02:19:22 +00:00
|
|
|
global_status.runtime += elapsed_secs;
|
2007-01-23 13:40:44 +00:00
|
|
|
lasttime += (elapsed_secs * HZ);
|
2006-04-02 12:23:08 +00:00
|
|
|
|
2007-01-24 02:19:22 +00:00
|
|
|
if ( global_status.runtime > global_status.topruntime )
|
|
|
|
global_status.topruntime = global_status.runtime;
|
|
|
|
}
|
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
void status_save(void)
|
2007-01-24 02:19:22 +00:00
|
|
|
{
|
|
|
|
update_runtime();
|
|
|
|
#ifdef HAVE_RTC_RAM
|
2008-11-01 16:14:28 +00:00
|
|
|
/* this will be done in the storage_callback if
|
2007-01-24 02:19:22 +00:00
|
|
|
target doesnt have rtc ram */
|
|
|
|
write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
|
|
|
|
#else
|
2008-11-01 16:14:28 +00:00
|
|
|
register_storage_idle_func(flush_global_status_callback);
|
2007-01-24 02:19:22 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
int settings_save(void)
|
2007-01-24 02:19:22 +00:00
|
|
|
{
|
|
|
|
update_runtime();
|
2007-01-23 13:40:44 +00:00
|
|
|
#ifdef HAVE_RTC_RAM
|
2008-11-01 16:14:28 +00:00
|
|
|
/* this will be done in the storage_callback if
|
2007-01-23 13:40:44 +00:00
|
|
|
target doesnt have rtc ram */
|
|
|
|
write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
|
2006-03-29 16:21:42 +00:00
|
|
|
#endif
|
2008-11-01 16:14:28 +00:00
|
|
|
register_storage_idle_func(flush_config_block_callback);
|
2002-07-28 16:09:44 +00:00
|
|
|
return 0;
|
2002-06-27 00:20:00 +00:00
|
|
|
}
|
2008-03-25 15:24:03 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
bool settings_save_config(int options)
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
2010-12-06 22:26:31 +00:00
|
|
|
char filename[MAX_PATH];
|
2010-08-01 16:15:27 +00:00
|
|
|
const char *folder, *namebase;
|
2007-05-29 04:39:11 +00:00
|
|
|
switch (options)
|
|
|
|
{
|
|
|
|
case SETTINGS_SAVE_THEME:
|
|
|
|
folder = THEME_DIR;
|
2009-07-01 11:21:59 +00:00
|
|
|
namebase = "theme";
|
2007-05-29 04:39:11 +00:00
|
|
|
break;
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
case SETTINGS_SAVE_RECPRESETS:
|
|
|
|
folder = RECPRESETS_DIR;
|
2009-07-01 11:21:59 +00:00
|
|
|
namebase = "recording";
|
2007-05-29 04:39:11 +00:00
|
|
|
break;
|
2007-12-07 10:59:07 +00:00
|
|
|
#endif
|
|
|
|
case SETTINGS_SAVE_EQPRESET:
|
|
|
|
folder = EQS_DIR;
|
2009-07-01 11:21:59 +00:00
|
|
|
namebase = "eq";
|
2007-12-07 10:59:07 +00:00
|
|
|
break;
|
2007-12-24 22:35:31 +00:00
|
|
|
case SETTINGS_SAVE_SOUND:
|
2009-07-01 11:21:59 +00:00
|
|
|
folder = ROCKBOX_DIR;
|
|
|
|
namebase = "sound";
|
|
|
|
break;
|
2007-05-29 04:39:11 +00:00
|
|
|
default:
|
|
|
|
folder = ROCKBOX_DIR;
|
2009-07-01 11:21:59 +00:00
|
|
|
namebase = "config";
|
|
|
|
break;
|
2007-05-29 04:39:11 +00:00
|
|
|
}
|
2009-07-01 11:21:59 +00:00
|
|
|
create_numbered_filename(filename, folder, namebase, ".cfg", 2
|
2007-01-29 13:18:57 +00:00
|
|
|
IF_CNFN_NUM_(, NULL));
|
|
|
|
|
|
|
|
/* allow user to modify filename */
|
|
|
|
while (true) {
|
2020-07-21 06:33:53 +00:00
|
|
|
if (!kbd_input(filename, sizeof(filename), NULL)) {
|
2007-01-29 13:18:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-01 13:57:14 +00:00
|
|
|
if (settings_write_config(filename, options))
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ, ID2P(LANG_SETTINGS_SAVED));
|
2007-02-16 10:20:30 +00:00
|
|
|
else
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ, ID2P(LANG_FAILED));
|
2007-01-29 13:18:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Apply and Reset settings **/
|
|
|
|
|
|
|
|
/*
|
2005-11-04 07:18:36 +00:00
|
|
|
* Applies the range infos stored in global_settings to
|
|
|
|
* the peak meter.
|
2002-10-29 12:09:15 +00:00
|
|
|
*/
|
|
|
|
void settings_apply_pm_range(void)
|
|
|
|
{
|
|
|
|
int pm_min, pm_max;
|
|
|
|
|
|
|
|
/* depending on the scale mode (dBfs or percent) the values
|
|
|
|
of global_settings.peak_meter_dbfs have different meanings */
|
2005-11-04 07:18:36 +00:00
|
|
|
if (global_settings.peak_meter_dbfs)
|
2002-10-29 12:09:15 +00:00
|
|
|
{
|
|
|
|
/* convert to dBfs * 100 */
|
|
|
|
pm_min = -(((int)global_settings.peak_meter_min) * 100);
|
|
|
|
pm_max = -(((int)global_settings.peak_meter_max) * 100);
|
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
else
|
2002-10-29 12:09:15 +00:00
|
|
|
{
|
|
|
|
/* percent is stored directly -> no conversion */
|
|
|
|
pm_min = global_settings.peak_meter_min;
|
|
|
|
pm_max = global_settings.peak_meter_max;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* apply the range */
|
|
|
|
peak_meter_init_range(global_settings.peak_meter_dbfs, pm_min, pm_max);
|
|
|
|
}
|
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
void sound_settings_apply(void)
|
2002-10-03 09:31:01 +00:00
|
|
|
{
|
2010-05-15 13:09:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_BASS
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_BASS, global_settings.bass);
|
2010-05-15 13:09:45 +00:00
|
|
|
#endif
|
|
|
|
#ifdef AUDIOHW_HAVE_TREBLE
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_TREBLE, global_settings.treble);
|
2010-05-15 13:09:45 +00:00
|
|
|
#endif
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_BALANCE, global_settings.balance);
|
2011-03-14 12:25:48 +00:00
|
|
|
#ifndef PLATFORM_HAS_VOLUME_CHANGE
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_VOLUME, global_settings.volume);
|
2011-03-14 12:25:48 +00:00
|
|
|
#endif
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_CHANNELS, global_settings.channel_config);
|
|
|
|
sound_set(SOUND_STEREO_WIDTH, global_settings.stereo_width);
|
2010-05-15 13:09:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_BASS_CUTOFF
|
2007-11-24 07:51:00 +00:00
|
|
|
sound_set(SOUND_BASS_CUTOFF, global_settings.bass_cutoff);
|
2010-05-15 13:09:45 +00:00
|
|
|
#endif
|
|
|
|
#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
|
2007-11-24 07:51:00 +00:00
|
|
|
sound_set(SOUND_TREBLE_CUTOFF, global_settings.treble_cutoff);
|
|
|
|
#endif
|
2010-05-15 13:09:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_DEPTH_3D
|
|
|
|
sound_set(SOUND_DEPTH_3D, global_settings.depth_3d);
|
|
|
|
#endif
|
2013-05-12 19:23:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
|
|
|
|
sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off);
|
|
|
|
#endif
|
2010-05-15 13:09:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_EQ
|
|
|
|
int b;
|
2004-07-06 12:17:14 +00:00
|
|
|
|
2010-05-15 13:09:45 +00:00
|
|
|
for (b = 0; b < AUDIOHW_EQ_BAND_NUM; b++)
|
|
|
|
{
|
|
|
|
int setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_GAIN);
|
|
|
|
sound_set(setting, global_settings.hw_eq_bands[b].gain);
|
|
|
|
|
|
|
|
#ifdef AUDIOHW_HAVE_EQ_FREQUENCY
|
|
|
|
setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_FREQUENCY);
|
|
|
|
if (setting != -1)
|
|
|
|
sound_set(setting, global_settings.hw_eq_bands[b].frequency);
|
|
|
|
#endif /* AUDIOHW_HAVE_EQ_FREQUENCY */
|
|
|
|
#ifdef AUDIOHW_HAVE_EQ_WIDTH
|
|
|
|
setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_WIDTH);
|
|
|
|
if (setting != -1)
|
|
|
|
sound_set(setting, global_settings.hw_eq_bands[b].width);
|
|
|
|
#endif /* AUDIOHW_HAVE_EQ_WIDTH */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2009-08-16 20:12:17 +00:00
|
|
|
|
2010-03-06 12:14:12 +00:00
|
|
|
void settings_apply(bool read_disk)
|
2004-07-06 12:17:14 +00:00
|
|
|
{
|
2010-04-01 16:27:21 +00:00
|
|
|
int rc;
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
CHART(">set_codepage");
|
|
|
|
set_codepage(global_settings.default_codepage);
|
|
|
|
CHART("<set_codepage");
|
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
sound_settings_apply();
|
2002-10-03 09:31:01 +00:00
|
|
|
|
2008-10-07 19:37:33 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2005-04-04 12:06:29 +00:00
|
|
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
2007-08-01 08:50:44 +00:00
|
|
|
#endif
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2006-07-31 19:13:21 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2002-10-03 09:31:01 +00:00
|
|
|
lcd_set_contrast(global_settings.contrast);
|
2006-07-25 11:15:50 +00:00
|
|
|
#endif
|
2002-10-03 09:31:01 +00:00
|
|
|
lcd_scroll_speed(global_settings.scroll_speed);
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-06-17 21:43:00 +00:00
|
|
|
lcd_remote_set_contrast(global_settings.remote_contrast);
|
|
|
|
lcd_remote_set_invert_display(global_settings.remote_invert);
|
2009-04-11 07:23:56 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_FLIP
|
2005-06-17 21:43:00 +00:00
|
|
|
lcd_remote_set_flip(global_settings.remote_flip_display);
|
2009-04-11 07:23:56 +00:00
|
|
|
#endif
|
|
|
|
|
2006-05-22 16:40:41 +00:00
|
|
|
lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
|
|
|
|
lcd_remote_scroll_step(global_settings.remote_scroll_step);
|
2007-02-21 13:34:45 +00:00
|
|
|
lcd_remote_scroll_delay(global_settings.remote_scroll_delay);
|
2006-07-22 13:47:11 +00:00
|
|
|
lcd_remote_bidir_scroll(global_settings.remote_bidir_limit);
|
2005-11-19 09:26:02 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
2005-11-19 08:05:03 +00:00
|
|
|
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
|
2005-11-19 09:26:02 +00:00
|
|
|
#endif
|
2005-05-30 00:00:22 +00:00
|
|
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
|
|
|
|
#endif
|
2006-09-10 02:00:40 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
|
2005-06-17 21:43:00 +00:00
|
|
|
#endif
|
2006-09-10 02:00:40 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2007-05-14 04:44:55 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
backlight_set_brightness(global_settings.brightness);
|
|
|
|
#endif
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2002-10-03 09:31:01 +00:00
|
|
|
backlight_set_timeout(global_settings.backlight_timeout);
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif
|
2009-01-26 23:21:49 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
|
|
|
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
2005-06-20 17:03:09 +00:00
|
|
|
backlight_set_fade_in(global_settings.backlight_fade_in);
|
|
|
|
backlight_set_fade_out(global_settings.backlight_fade_out);
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif
|
2005-12-22 10:43:36 +00:00
|
|
|
#endif
|
2007-05-08 06:45:38 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
buttonlight_set_brightness(global_settings.buttonlight_brightness);
|
|
|
|
#endif
|
2007-05-14 04:44:55 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2007-10-07 15:02:02 +00:00
|
|
|
buttonlight_set_timeout(global_settings.buttonlight_timeout);
|
2005-06-20 17:03:09 +00:00
|
|
|
#endif
|
2008-10-07 19:37:33 +00:00
|
|
|
#ifdef HAVE_DISK_STORAGE
|
2008-11-01 16:14:28 +00:00
|
|
|
storage_spindown(global_settings.disk_spindown);
|
2003-11-03 23:36:36 +00:00
|
|
|
#endif
|
2002-10-03 09:31:01 +00:00
|
|
|
set_poweroff_timeout(global_settings.poweroff);
|
2011-12-26 09:57:55 +00:00
|
|
|
if (global_settings.sleeptimer_on_startup)
|
2012-10-05 19:30:13 +00:00
|
|
|
set_sleeptimer_duration(global_settings.sleeptimer_duration);
|
2011-12-26 09:30:25 +00:00
|
|
|
set_keypress_restarts_sleep_timer(
|
|
|
|
global_settings.keypress_restarts_sleeptimer);
|
2002-10-08 15:42:40 +00:00
|
|
|
|
2010-09-01 23:36:15 +00:00
|
|
|
#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
|
2010-09-01 23:49:28 +00:00
|
|
|
/* only call if it's really exchangable */
|
2002-12-16 22:58:48 +00:00
|
|
|
set_battery_capacity(global_settings.battery_capacity);
|
2010-09-01 23:36:15 +00:00
|
|
|
#endif
|
|
|
|
|
2005-01-30 16:25:46 +00:00
|
|
|
#if BATTERY_TYPES_COUNT > 1
|
|
|
|
set_battery_type(global_settings.battery_type);
|
|
|
|
#endif
|
2002-12-16 22:58:48 +00:00
|
|
|
|
2009-01-03 12:48:06 +00:00
|
|
|
#ifdef HAVE_LCD_INVERT
|
2003-02-27 14:22:30 +00:00
|
|
|
lcd_set_invert_display(global_settings.invert);
|
2009-01-03 12:48:06 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_FLIP
|
2003-12-20 10:00:37 +00:00
|
|
|
lcd_set_flip(global_settings.flip_display);
|
2009-10-05 17:53:45 +00:00
|
|
|
button_set_flip(global_settings.flip_display);
|
2009-01-03 12:48:06 +00:00
|
|
|
#endif
|
2007-01-23 13:40:44 +00:00
|
|
|
lcd_update(); /* refresh after flipping the screen */
|
2002-10-29 12:09:15 +00:00
|
|
|
settings_apply_pm_range();
|
|
|
|
peak_meter_init_times(
|
2005-11-04 07:18:36 +00:00
|
|
|
global_settings.peak_meter_release, global_settings.peak_meter_hold,
|
2002-10-29 12:09:15 +00:00
|
|
|
global_settings.peak_meter_clip_hold);
|
|
|
|
|
2009-03-02 18:18:24 +00:00
|
|
|
#ifdef HAVE_SPEAKER
|
2017-01-14 00:40:12 +00:00
|
|
|
audio_enable_speaker(global_settings.speaker_mode);
|
2009-03-02 18:18:24 +00:00
|
|
|
#endif
|
|
|
|
|
2010-03-06 12:14:12 +00:00
|
|
|
if (read_disk)
|
|
|
|
{
|
2010-07-25 14:29:06 +00:00
|
|
|
char buf[MAX_PATH];
|
2010-03-06 12:14:12 +00:00
|
|
|
/* fonts need to be loaded before the WPS */
|
|
|
|
if (global_settings.font_file[0]
|
|
|
|
&& global_settings.font_file[0] != '-') {
|
2011-11-08 10:09:33 +00:00
|
|
|
int font_ui = screens[SCREEN_MAIN].getuifont();
|
|
|
|
const char* loaded_font = font_filename(font_ui);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2010-12-06 22:26:31 +00:00
|
|
|
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
|
2010-03-06 12:14:12 +00:00
|
|
|
global_settings.font_file);
|
2011-09-24 13:19:34 +00:00
|
|
|
if (!loaded_font || strcmp(loaded_font, buf))
|
|
|
|
{
|
|
|
|
CHART2(">font_load ", global_settings.font_file);
|
2011-11-08 10:09:33 +00:00
|
|
|
if (font_ui >= 0)
|
|
|
|
font_unload(font_ui);
|
2011-11-20 15:41:17 +00:00
|
|
|
rc = font_load_ex(buf, 0, global_settings.glyphs_to_cache);
|
2011-09-24 13:19:34 +00:00
|
|
|
CHART2("<font_load ", global_settings.font_file);
|
2011-11-08 10:09:33 +00:00
|
|
|
screens[SCREEN_MAIN].setuifont(rc);
|
|
|
|
screens[SCREEN_MAIN].setfont(rc);
|
2011-09-24 13:19:34 +00:00
|
|
|
}
|
2010-03-06 12:14:12 +00:00
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2010-03-06 12:14:12 +00:00
|
|
|
if ( global_settings.remote_font_file[0]
|
|
|
|
&& global_settings.remote_font_file[0] != '-') {
|
2011-11-08 10:09:33 +00:00
|
|
|
int font_ui = screens[SCREEN_REMOTE].getuifont();
|
|
|
|
const char* loaded_font = font_filename(font_ui);
|
2011-01-26 07:46:02 +00:00
|
|
|
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
|
2010-03-06 12:14:12 +00:00
|
|
|
global_settings.remote_font_file);
|
2011-09-24 13:19:34 +00:00
|
|
|
if (!loaded_font || strcmp(loaded_font, buf))
|
|
|
|
{
|
|
|
|
CHART2(">font_load_remoteui ", global_settings.remote_font_file);
|
2011-11-08 10:09:33 +00:00
|
|
|
if (font_ui >= 0)
|
|
|
|
font_unload(font_ui);
|
2011-09-24 13:19:34 +00:00
|
|
|
rc = font_load(buf);
|
|
|
|
CHART2("<font_load_remoteui ", global_settings.remote_font_file);
|
2011-11-08 10:09:33 +00:00
|
|
|
screens[SCREEN_REMOTE].setuifont(rc);
|
|
|
|
screens[SCREEN_REMOTE].setfont(rc);
|
2011-09-24 13:19:34 +00:00
|
|
|
}
|
2010-03-06 12:14:12 +00:00
|
|
|
}
|
2010-02-14 06:26:16 +00:00
|
|
|
#endif
|
2011-01-02 22:41:35 +00:00
|
|
|
if ( global_settings.kbd_file[0]
|
|
|
|
&& global_settings.kbd_file[0] != '-') {
|
2010-12-06 22:26:31 +00:00
|
|
|
snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
|
2010-03-06 12:14:12 +00:00
|
|
|
global_settings.kbd_file);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">load_kbd");
|
2010-03-06 12:14:12 +00:00
|
|
|
load_kbd(buf);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<load_kbd");
|
2010-03-06 12:14:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
load_kbd(NULL);
|
|
|
|
if ( global_settings.lang_file[0]) {
|
|
|
|
snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
|
|
|
|
global_settings.lang_file);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">lang_core_load");
|
2010-03-06 12:14:12 +00:00
|
|
|
lang_core_load(buf);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<lang_core_load");
|
2010-03-06 12:14:12 +00:00
|
|
|
}
|
2014-01-28 14:34:53 +00:00
|
|
|
CHART(">talk_init");
|
|
|
|
talk_init(); /* use voice of same language */
|
|
|
|
CHART("<talk_init");
|
2009-08-16 20:12:17 +00:00
|
|
|
|
2010-03-06 12:14:12 +00:00
|
|
|
/* load the icon set */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">icons_init");
|
2010-03-06 12:14:12 +00:00
|
|
|
icons_init();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<icons_init");
|
2008-03-06 07:03:14 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2011-01-02 22:44:15 +00:00
|
|
|
if (global_settings.colors_file[0]
|
|
|
|
&& global_settings.colors_file[0] != '-')
|
2010-04-01 16:27:21 +00:00
|
|
|
{
|
|
|
|
CHART(">read_color_theme_file");
|
2010-03-06 12:14:12 +00:00
|
|
|
read_color_theme_file();
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<read_color_theme_file");
|
|
|
|
}
|
2008-03-06 07:03:14 +00:00
|
|
|
#endif
|
2010-03-06 12:14:12 +00:00
|
|
|
}
|
2006-11-13 00:45:21 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-02-26 02:48:05 +00:00
|
|
|
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
|
|
|
|
screens[SCREEN_MAIN].set_background(global_settings.bg_color);
|
2006-02-02 20:42:56 +00:00
|
|
|
#endif
|
|
|
|
|
2002-12-12 15:20:37 +00:00
|
|
|
lcd_scroll_step(global_settings.scroll_step);
|
2006-01-22 01:42:05 +00:00
|
|
|
gui_list_screen_scroll_step(global_settings.screen_scroll_step);
|
|
|
|
gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
|
2003-02-12 09:07:48 +00:00
|
|
|
lcd_bidir_scroll(global_settings.bidir_limit);
|
2007-02-21 13:34:45 +00:00
|
|
|
lcd_scroll_delay(global_settings.scroll_delay);
|
2002-10-09 23:13:25 +00:00
|
|
|
|
2005-06-09 09:47:00 +00:00
|
|
|
|
2013-05-23 17:58:51 +00:00
|
|
|
#ifdef HAVE_PLAY_FREQ
|
2017-11-24 12:55:56 +00:00
|
|
|
/* before crossfade */
|
|
|
|
audio_set_playback_frequency(global_settings.play_frequency);
|
2013-05-23 17:58:51 +00:00
|
|
|
#endif
|
2009-11-10 03:46:08 +00:00
|
|
|
#ifdef HAVE_CROSSFADE
|
2005-07-22 16:46:27 +00:00
|
|
|
audio_set_crossfade(global_settings.crossfade);
|
2009-11-10 03:46:08 +00:00
|
|
|
#endif
|
2012-04-30 20:27:01 +00:00
|
|
|
replaygain_update();
|
2012-05-01 07:58:27 +00:00
|
|
|
dsp_set_crossfeed_type(global_settings.crossfeed);
|
2006-04-11 13:49:05 +00:00
|
|
|
dsp_set_crossfeed_direct_gain(global_settings.crossfeed_direct_gain);
|
|
|
|
dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
|
2007-03-07 15:06:33 +00:00
|
|
|
global_settings.crossfeed_hf_attenuation,
|
2006-04-11 13:49:05 +00:00
|
|
|
global_settings.crossfeed_hf_cutoff);
|
2006-03-27 21:20:35 +00:00
|
|
|
|
2007-04-11 09:13:13 +00:00
|
|
|
/* Configure software equalizer, hardware eq is handled in audio_init() */
|
2012-03-27 23:52:15 +00:00
|
|
|
dsp_eq_enable(global_settings.eq_enabled);
|
2006-03-30 05:56:19 +00:00
|
|
|
dsp_set_eq_precut(global_settings.eq_precut);
|
2012-03-27 23:52:15 +00:00
|
|
|
for(int i = 0; i < EQ_NUM_BANDS; i++) {
|
|
|
|
dsp_set_eq_coefs(i, &global_settings.eq_band_settings[i]);
|
2006-02-17 19:56:22 +00:00
|
|
|
}
|
2006-10-27 20:41:33 +00:00
|
|
|
|
|
|
|
dsp_dither_enable(global_settings.dithering_enabled);
|
2014-08-22 13:30:35 +00:00
|
|
|
dsp_surround_set_balance(global_settings.surround_balance);
|
|
|
|
dsp_surround_set_cutoff(global_settings.surround_fx1, global_settings.surround_fx2);
|
|
|
|
dsp_surround_mix(global_settings.surround_mix);
|
|
|
|
dsp_surround_enable(global_settings.surround_enabled);
|
|
|
|
dsp_afr_enable(global_settings.afr_enabled);
|
|
|
|
dsp_pbe_precut(global_settings.pbe_precut);
|
|
|
|
dsp_pbe_enable(global_settings.pbe);
|
2012-05-08 14:34:26 +00:00
|
|
|
#ifdef HAVE_PITCHCONTROL
|
2009-06-12 07:20:50 +00:00
|
|
|
dsp_timestretch_enable(global_settings.timestretch_enabled);
|
2010-09-17 20:28:47 +00:00
|
|
|
#endif
|
2012-04-26 21:19:16 +00:00
|
|
|
dsp_set_compressor(&global_settings.compressor_settings);
|
2005-07-01 09:42:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
spdif_power_enable(global_settings.spdif_enable);
|
|
|
|
#endif
|
2006-03-24 13:47:24 +00:00
|
|
|
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2006-03-24 13:47:24 +00:00
|
|
|
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
set_selective_backlight_actions(global_settings.bl_selective_actions,
|
|
|
|
global_settings.bl_selective_actions_mask,
|
|
|
|
global_settings.bl_filter_first_keypress);
|
2006-03-25 19:16:45 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
|
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
|
|
|
|
#endif
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2008-05-14 19:29:25 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
2006-08-08 22:03:56 +00:00
|
|
|
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
|
2006-03-24 13:47:24 +00:00
|
|
|
#endif
|
2007-04-12 22:12:13 +00:00
|
|
|
#endif /* HAVE_BACKLIGHT */
|
2006-11-06 18:07:30 +00:00
|
|
|
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
set_selective_softlock_actions(
|
|
|
|
global_settings.bt_selective_softlock_actions,
|
|
|
|
global_settings.bt_selective_softlock_actions_mask);
|
|
|
|
#endif
|
|
|
|
|
2008-05-29 21:27:44 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
|
|
|
touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
|
|
|
|
#endif
|
|
|
|
|
2013-12-01 18:25:42 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_DEADZONE
|
|
|
|
touchpad_set_deadzone(global_settings.touchpad_deadzone);
|
|
|
|
#endif
|
|
|
|
|
2012-12-26 17:01:19 +00:00
|
|
|
#ifdef HAVE_USB_CHARGING_ENABLE
|
2008-12-28 12:37:03 +00:00
|
|
|
usb_charging_enable(global_settings.usb_charging);
|
|
|
|
#endif
|
|
|
|
|
2020-11-16 17:55:33 +00:00
|
|
|
#if defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR)
|
2020-11-16 16:32:12 +00:00
|
|
|
usb_set_mode(global_settings.usb_mode);
|
|
|
|
#endif
|
|
|
|
|
2009-03-24 21:55:05 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
touchscreen_set_mode(global_settings.touch_mode);
|
2009-06-16 17:04:47 +00:00
|
|
|
memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
|
2009-03-24 21:55:05 +00:00
|
|
|
#endif
|
|
|
|
|
2015-01-30 21:47:30 +00:00
|
|
|
#if defined(DX50) || defined(DX90)
|
|
|
|
ibasso_set_governor(global_settings.governor);
|
2015-01-21 19:51:36 +00:00
|
|
|
ibasso_set_usb_mode(global_settings.usb_mode);
|
2015-01-30 21:47:30 +00:00
|
|
|
#endif
|
|
|
|
|
2006-11-06 18:07:30 +00:00
|
|
|
/* This should stay last */
|
2020-07-17 04:01:32 +00:00
|
|
|
#if defined(HAVE_RECORDING)
|
2006-11-06 18:07:30 +00:00
|
|
|
enc_global_settings_apply();
|
2007-06-17 21:16:34 +00:00
|
|
|
#endif
|
2009-10-19 15:28:15 +00:00
|
|
|
/* already called with THEME_STATUSBAR in settings_apply_skins() */
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART(">viewportmanager_theme_changed");
|
2010-03-06 15:02:22 +00:00
|
|
|
viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE|THEME_BUTTONBAR);
|
2010-04-01 16:27:21 +00:00
|
|
|
CHART("<viewportmanager_theme_changed");
|
2002-10-03 09:31:01 +00:00
|
|
|
}
|
|
|
|
|
2003-03-10 16:31:02 +00:00
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2005-11-04 07:18:36 +00:00
|
|
|
* reset all settings to their default value
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2008-04-20 14:12:28 +00:00
|
|
|
void reset_setting(const struct settings_list *setting, void *var)
|
|
|
|
{
|
|
|
|
switch (setting->flags&F_T_MASK)
|
|
|
|
{
|
2008-11-03 10:43:37 +00:00
|
|
|
case F_T_CUSTOM:
|
|
|
|
setting->custom_setting->set_default(setting->setting,
|
|
|
|
setting->default_val.custom);
|
|
|
|
break;
|
2008-04-20 14:12:28 +00:00
|
|
|
case F_T_INT:
|
|
|
|
case F_T_UINT:
|
|
|
|
if (setting->flags&F_DEF_ISFUNC)
|
|
|
|
*(int*)var = setting->default_val.func();
|
|
|
|
else if (setting->flags&F_T_SOUND)
|
|
|
|
*(int*)var = sound_default(setting->sound_setting->setting);
|
|
|
|
else *(int*)var = setting->default_val.int_;
|
|
|
|
break;
|
|
|
|
case F_T_BOOL:
|
|
|
|
*(bool*)var = setting->default_val.bool_;
|
|
|
|
break;
|
|
|
|
case F_T_CHARPTR:
|
|
|
|
case F_T_UCHARPTR:
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy((char*)var, setting->default_val.charptr,
|
2008-04-20 14:12:28 +00:00
|
|
|
setting->filename_setting->max_len);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void settings_reset(void)
|
2008-03-25 15:24:03 +00:00
|
|
|
{
|
2011-10-15 19:35:02 +00:00
|
|
|
for(int i=0; i<nb_settings; i++)
|
2008-04-20 14:12:28 +00:00
|
|
|
reset_setting(&settings[i], settings[i].setting);
|
2020-07-17 04:01:32 +00:00
|
|
|
#if defined (HAVE_RECORDING)
|
2006-11-06 18:07:30 +00:00
|
|
|
enc_global_settings_reset();
|
|
|
|
#endif
|
2011-09-24 13:19:34 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
2011-11-08 10:09:33 +00:00
|
|
|
if (screens[i].getuifont() > FONT_SYSFIXED)
|
2011-09-24 13:19:34 +00:00
|
|
|
{
|
2011-11-08 10:09:33 +00:00
|
|
|
font_unload(screens[i].getuifont());
|
|
|
|
screens[i].setuifont(FONT_SYSFIXED);
|
|
|
|
screens[i].setfont(FONT_SYSFIXED);
|
2011-09-24 13:19:34 +00:00
|
|
|
}
|
|
|
|
}
|
2002-06-27 00:20:00 +00:00
|
|
|
}
|
2002-06-27 01:08:11 +00:00
|
|
|
|
2007-01-29 13:18:57 +00:00
|
|
|
/** Changing setting values **/
|
2008-03-25 15:24:03 +00:00
|
|
|
const struct settings_list* find_setting(const void* variable, int *id)
|
2007-02-08 04:33:41 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i=0;i<nb_settings;i++)
|
|
|
|
{
|
|
|
|
if (settings[i].setting == variable)
|
2007-02-08 10:28:42 +00:00
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
*id = i;
|
2007-02-08 04:33:41 +00:00
|
|
|
return &settings[i];
|
2007-02-08 10:28:42 +00:00
|
|
|
}
|
2007-02-08 04:33:41 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-09-04 13:17:09 +00:00
|
|
|
const struct settings_list* find_setting_by_cfgname(const char* name, int *id)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<nb_settings; i++)
|
|
|
|
{
|
|
|
|
if (settings[i].cfg_name &&
|
|
|
|
!strcmp(settings[i].cfg_name, name))
|
|
|
|
{
|
|
|
|
if (id) *id = i;
|
|
|
|
return &settings[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-02-05 09:09:38 +00:00
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
bool set_bool(const char* string, const bool* variable )
|
2002-06-27 01:08:11 +00:00
|
|
|
{
|
2005-10-16 11:15:51 +00:00
|
|
|
return set_bool_options(string, variable,
|
2005-12-05 22:44:42 +00:00
|
|
|
(char *)STR(LANG_SET_BOOL_YES),
|
|
|
|
(char *)STR(LANG_SET_BOOL_NO),
|
|
|
|
NULL);
|
2003-06-05 11:11:10 +00:00
|
|
|
}
|
|
|
|
|
2002-08-20 19:37:00 +00:00
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
bool set_bool_options(const char* string, const bool* variable,
|
2008-03-28 12:51:33 +00:00
|
|
|
const char* yes_str, int yes_voice,
|
|
|
|
const char* no_str, int no_voice,
|
2004-03-15 08:27:51 +00:00
|
|
|
void (*function)(bool))
|
2002-09-05 04:42:12 +00:00
|
|
|
{
|
2005-12-05 22:44:42 +00:00
|
|
|
struct opt_items names[] = {
|
2008-03-25 15:24:03 +00:00
|
|
|
{(unsigned const char *)no_str, no_voice},
|
|
|
|
{(unsigned const char *)yes_str, yes_voice}
|
2005-12-05 22:44:42 +00:00
|
|
|
};
|
2002-09-24 17:22:12 +00:00
|
|
|
bool result;
|
|
|
|
|
2005-11-04 07:18:36 +00:00
|
|
|
result = set_option(string, variable, BOOL, names, 2,
|
2018-10-16 03:04:04 +00:00
|
|
|
(void (*)(int))(void (*)(void))function);
|
2002-09-24 17:22:12 +00:00
|
|
|
return result;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
|
|
|
|
2007-02-12 14:22:35 +00:00
|
|
|
bool set_int(const unsigned char* string,
|
|
|
|
const char* unit,
|
2008-03-28 12:51:33 +00:00
|
|
|
int voice_unit,
|
2008-03-25 15:24:03 +00:00
|
|
|
const int* variable,
|
2007-02-12 14:22:35 +00:00
|
|
|
void (*function)(int),
|
2008-03-28 12:51:33 +00:00
|
|
|
int step,
|
|
|
|
int min,
|
|
|
|
int max,
|
2009-08-20 16:47:44 +00:00
|
|
|
const char* (*formatter)(char*, size_t, int, const char*) )
|
2007-02-12 14:22:35 +00:00
|
|
|
{
|
|
|
|
return set_int_ex(string, unit, voice_unit, variable, function,
|
|
|
|
step, min, max, formatter, NULL);
|
|
|
|
}
|
2007-07-11 05:41:23 +00:00
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
bool set_int_ex(const unsigned char* string,
|
|
|
|
const char* unit,
|
2008-03-28 12:51:33 +00:00
|
|
|
int voice_unit,
|
2008-03-25 15:24:03 +00:00
|
|
|
const int* variable,
|
|
|
|
void (*function)(int),
|
2008-03-28 12:51:33 +00:00
|
|
|
int step,
|
|
|
|
int min,
|
|
|
|
int max,
|
2009-08-20 16:47:44 +00:00
|
|
|
const char* (*formatter)(char*, size_t, int, const char*),
|
2008-03-25 15:24:03 +00:00
|
|
|
int32_t (*get_talk_id)(int, int))
|
|
|
|
{
|
|
|
|
(void)unit;
|
|
|
|
struct settings_list item;
|
|
|
|
struct int_setting data = {
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
function, voice_unit, min, max, step,
|
2008-03-25 15:24:03 +00:00
|
|
|
formatter, get_talk_id
|
|
|
|
};
|
|
|
|
item.int_setting = &data;
|
|
|
|
item.flags = F_INT_SETTING|F_T_INT;
|
|
|
|
item.lang_id = -1;
|
|
|
|
item.cfg_vals = (char*)string;
|
|
|
|
item.setting = (void *)variable;
|
2009-11-11 06:39:23 +00:00
|
|
|
return option_screen(&item, NULL, false, NULL);
|
2008-03-25 15:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct opt_items *set_option_options;
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* set_option_formatter(char* buf, size_t size, int item, const char* unit)
|
2008-03-25 15:24:03 +00:00
|
|
|
{
|
2009-08-20 16:47:44 +00:00
|
|
|
(void)buf, (void)unit, (void)size;
|
|
|
|
return P2STR(set_option_options[item].string);
|
2008-03-25 15:24:03 +00:00
|
|
|
}
|
2009-08-20 16:47:44 +00:00
|
|
|
|
2008-03-25 15:24:03 +00:00
|
|
|
static int32_t set_option_get_talk_id(int value, int unit)
|
|
|
|
{
|
|
|
|
(void)unit;
|
|
|
|
return set_option_options[value].voice_id;
|
|
|
|
}
|
2009-08-20 16:47:44 +00:00
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
bool set_option(const char* string, const void* variable, enum optiontype type,
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
const struct opt_items* options,
|
2008-03-28 12:51:33 +00:00
|
|
|
int numoptions, void (*function)(int))
|
2008-03-25 15:24:03 +00:00
|
|
|
{
|
|
|
|
int temp;
|
|
|
|
struct settings_list item;
|
|
|
|
struct int_setting data = {
|
|
|
|
function, UNIT_INT, 0, numoptions-1, 1,
|
|
|
|
set_option_formatter, set_option_get_talk_id
|
|
|
|
};
|
2014-12-22 20:30:30 +00:00
|
|
|
memset(&item, 0, sizeof(struct settings_list));
|
2008-03-25 15:24:03 +00:00
|
|
|
set_option_options = options;
|
|
|
|
item.int_setting = &data;
|
|
|
|
item.flags = F_INT_SETTING|F_T_INT;
|
|
|
|
item.lang_id = -1;
|
|
|
|
item.cfg_vals = (char*)string;
|
|
|
|
item.setting = &temp;
|
|
|
|
if (type == BOOL)
|
|
|
|
temp = *(bool*)variable? 1: 0;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else
|
2008-03-25 15:24:03 +00:00
|
|
|
temp = *(int*)variable;
|
2008-04-23 11:07:40 +00:00
|
|
|
if (!option_screen(&item, NULL, false, NULL))
|
2008-03-25 15:24:03 +00:00
|
|
|
{
|
|
|
|
if (type == BOOL)
|
2010-08-01 16:15:27 +00:00
|
|
|
|
2009-05-21 14:15:24 +00:00
|
|
|
*(bool*)variable = (temp == 1);
|
2008-03-25 15:24:03 +00:00
|
|
|
else
|
|
|
|
*(int*)variable = temp;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2002-08-09 12:38:45 +00:00
|
|
|
|
2010-07-25 22:45:57 +00:00
|
|
|
/*
|
2010-08-02 19:13:22 +00:00
|
|
|
* Takes filename, removes the directory and the extension,
|
|
|
|
* and then copies the basename into setting, unless the basename exceeds maxlen
|
2010-07-25 22:45:57 +00:00
|
|
|
**/
|
|
|
|
void set_file(const char* filename, char* setting, const int maxlen)
|
2007-01-29 13:18:57 +00:00
|
|
|
{
|
2009-06-29 14:25:42 +00:00
|
|
|
const char* fptr = strrchr(filename,'/');
|
2010-07-25 22:45:57 +00:00
|
|
|
const char* extptr;
|
2007-01-29 13:18:57 +00:00
|
|
|
int len;
|
|
|
|
int extlen = 0;
|
|
|
|
|
|
|
|
if (!fptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fptr++;
|
|
|
|
|
2010-07-25 22:45:57 +00:00
|
|
|
extptr = strrchr(fptr, '.');
|
2007-01-29 13:18:57 +00:00
|
|
|
|
2010-07-25 22:45:57 +00:00
|
|
|
if (!extptr || extptr < fptr)
|
|
|
|
extlen = 0;
|
|
|
|
else
|
|
|
|
extlen = strlen(extptr);
|
|
|
|
|
2010-07-26 00:06:06 +00:00
|
|
|
len = strlen(fptr) - extlen + 1;
|
2007-01-29 13:18:57 +00:00
|
|
|
|
2010-07-25 22:45:57 +00:00
|
|
|
/* error if filename isn't in ROCKBOX_DIR */
|
2010-08-02 19:13:22 +00:00
|
|
|
if (len > maxlen)
|
2010-07-25 22:45:57 +00:00
|
|
|
return;
|
2007-01-29 13:18:57 +00:00
|
|
|
|
2010-07-26 00:06:06 +00:00
|
|
|
strlcpy(setting, fptr, len);
|
2007-01-29 13:18:57 +00:00
|
|
|
settings_save();
|
|
|
|
}
|