use core provided button names if not overridden

plus misc cleanup (forgot to commit last night)
This commit is contained in:
Shaun Inman 2023-02-16 10:38:25 -05:00
parent 896c13e9e0
commit 5aca139047
2 changed files with 3 additions and 8 deletions

View file

@ -1029,19 +1029,16 @@ int PAD_justRepeated(int btn) { return pad.just_repeated & btn; }
/////////////////////////////// ///////////////////////////////
static struct VIB_Context { static struct VIB_Context {
pthread_t pt; pthread_t pt;
int queued_strength; int queued_strength;
int strength; int strength;
} vib; } vib;
static void* VIB_thread(void *arg) { static void* VIB_thread(void *arg) {
char buffer[4];
#define DEFER_FRAMES 3 #define DEFER_FRAMES 3
static int defer = 0; static int defer = 0;
while(1) { while(1) {
SDL_Delay(4); SDL_Delay(17);
if (vib.queued_strength!=vib.strength) { if (vib.queued_strength!=vib.strength) {
if (defer<DEFER_FRAMES && vib.queued_strength==0) { // minimize vacillation between 0 and some number (which this motor doesn't like) if (defer<DEFER_FRAMES && vib.queued_strength==0) { // minimize vacillation between 0 and some number (which this motor doesn't like)
defer += 1; defer += 1;
@ -1157,7 +1154,6 @@ static int can_poweroff = 1;
void POW_disablePowerOff(void) { void POW_disablePowerOff(void) {
can_poweroff = 0; can_poweroff = 0;
} }
void POW_powerOff(void) { void POW_powerOff(void) {
if (can_poweroff) { if (can_poweroff) {
char* msg = exists(AUTO_RESUME_PATH) ? "Quicksave created,\npowering off" : "Powering off"; char* msg = exists(AUTO_RESUME_PATH) ? "Quicksave created,\npowering off" : "Powering off";
@ -1174,7 +1170,6 @@ void POW_powerOff(void) {
} }
#define BACKLIGHT_PATH "/sys/class/backlight/backlight.2/bl_power" #define BACKLIGHT_PATH "/sys/class/backlight/backlight.2/bl_power"
#define CPU_SPEED_SET_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed" #define CPU_SPEED_SET_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
#define CPU_SPEED_GET_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" #define CPU_SPEED_GET_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
static int previous_speed = CPU_SPEED_NORMAL; static int previous_speed = CPU_SPEED_NORMAL;
@ -1248,8 +1243,7 @@ int POW_preventAutosleep(void) {
int POW_isCharging(void) { int POW_isCharging(void) {
return getInt("/sys/class/power_supply/battery/charger_online"); return getInt("/sys/class/power_supply/battery/charger_online");
} }
int POW_getBattery(void) { // 5-100 in 25% fragments int POW_getBattery(void) { // 10-100 in 10-20% fragments
// TODO: move to infrequently called thread
int i = getInt("/sys/class/power_supply/battery/voltage_now") / 10000; // 310-410 int i = getInt("/sys/class/power_supply/battery/voltage_now") / 10000; // 310-410
i -= 310; // ~0-100 i -= 310; // ~0-100

View file

@ -1204,6 +1204,7 @@ void Input_init(const struct retro_input_descriptor *vars) {
for (int i=0;default_button_mapping[i].name; i++) { for (int i=0;default_button_mapping[i].name; i++) {
ButtonMapping* mapping = &default_button_mapping[i]; ButtonMapping* mapping = &default_button_mapping[i];
LOG_info("DEFAULT %s (%s): <%s>\n", core_button_names[mapping->retro], mapping->name, (mapping->local==BTN_ID_NONE ? "NONE" : device_button_names[mapping->local])); LOG_info("DEFAULT %s (%s): <%s>\n", core_button_names[mapping->retro], mapping->name, (mapping->local==BTN_ID_NONE ? "NONE" : device_button_names[mapping->local]));
mapping->name = (char*)core_button_names[mapping->retro];
} }
for (int i=0; config.controls[i].name; i++) { for (int i=0; config.controls[i].name; i++) {