diff --git a/src/config.c b/src/config.c index 55c18f37..0fd747ae 100644 --- a/src/config.c +++ b/src/config.c @@ -30,6 +30,8 @@ #include "graphics.h" #include "input/vita.h" +#include + #define MOONLIGHT_PATH "/moonlight" #define USER_PATHS "." #define DEFAULT_CONFIG_DIR "/.config" @@ -226,6 +228,8 @@ static int ini_handle(void *out, const char *section, const char *name, config->localaudio = BOOL(value); } else if (strcmp(name, "disable_powersave") == 0) { config->disable_powersave = BOOL(value); + } else if (strcmp(name, "mapping") == 0) { + config->mapping = STR(value); } } } @@ -297,6 +301,7 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) { config->stream.supportsHevc = false; config->platform = "vita"; + config->model = sceKernelGetModelForCDialog(); config->app = "Steam"; config->action = NULL; config->address = NULL; diff --git a/src/gui/ui_settings.c b/src/gui/ui_settings.c index f4b6823d..68437758 100644 --- a/src/gui/ui_settings.c +++ b/src/gui/ui_settings.c @@ -443,9 +443,10 @@ static int settings_loop(int id, void *context) { if (was_button_pressed(SCE_CTRL_CROSS)) { did_change = 1; if (config.mapping) { + free(config.mapping); config.mapping = 0; } else { - config.mapping = "mappings/vita.conf"; + config.mapping = strdup("mappings/vita.conf"); } } break; case SETTINGS_BACK_DEADZONE: diff --git a/src/input/vita.c b/src/input/vita.c index bae0bef3..496482cc 100644 --- a/src/input/vita.c +++ b/src/input/vita.c @@ -166,14 +166,14 @@ inline uint8_t read_backscreen() { } } - if (touch.button & TOUCHSEC_SOUTHWEST) { + if ((touch.button & TOUCHSEC_SOUTHWEST) == 0) { if (IN_SECTION(BACK_SECTIONS[2], x, y)) { touch.button |= TOUCHSEC_SOUTHWEST; continue; } } - if (touch.button & TOUCHSEC_SOUTHEAST) { + if ((touch.button & TOUCHSEC_SOUTHEAST) == 0) { if (IN_SECTION(BACK_SECTIONS[3], x, y)) { touch.button |= TOUCHSEC_SOUTHEAST; continue; @@ -203,14 +203,14 @@ inline uint8_t read_frontscreen() { } } - if (touch.button & TOUCHSEC_SPECIAL_SW) { + if ((touch.button & TOUCHSEC_SPECIAL_SW) == 0) { if (IN_SECTION(FRONT_SECTIONS[2], x, y)) { touch.button |= TOUCHSEC_SPECIAL_SW; continue; } } - if (touch.button & TOUCHSEC_SPECIAL_SE) { + if ((touch.button & TOUCHSEC_SPECIAL_SE) == 0) { if (IN_SECTION(FRONT_SECTIONS[3], x, y)) { touch.button |= TOUCHSEC_SPECIAL_SE; continue; @@ -341,6 +341,7 @@ inline void vitainput_process(void) { memset(&touch, 0, sizeof(TouchData)); memset(&curr, 0, sizeof(input_data)); + sceCtrlSetSamplingModeExt(SCE_CTRL_MODE_ANALOG_WIDE); sceCtrlReadBufferPositiveExt2(controller_port, &pad, 1); sceTouchPeek(SCE_TOUCH_PORT_FRONT, &front, 1); @@ -382,8 +383,8 @@ inline void vitainput_process(void) { is_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_NE), is_old_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_NE)); special(config.special_keys.sw, - is_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_NW), - is_old_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_NW)); + is_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_SW), + is_old_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_SW)); special(config.special_keys.se, is_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_SE), is_old_pressed(INPUT_TYPE_TOUCHSCREEN | TOUCHSEC_SPECIAL_SE)); @@ -473,7 +474,7 @@ bool vitainput_init() { sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); - SceUID thid = sceKernelCreateThread("vitainput_thread", vitainput_thread, 0x10000100, 0x40000, 0, 0, NULL); + SceUID thid = sceKernelCreateThread("vitainput_thread", vitainput_thread, 0, 0x40000, 0, 0, NULL); if (thid >= 0) { sceKernelStartThread(thid, 0, NULL); return true; diff --git a/src/input/vita.h b/src/input/vita.h index ed4eca36..2eaba852 100644 --- a/src/input/vita.h +++ b/src/input/vita.h @@ -32,8 +32,8 @@ enum { TOUCHSEC_SOUTHEAST = 0x8, TOUCHSEC_SPECIAL_NW = 0x10, TOUCHSEC_SPECIAL_NE = 0x20, - TOUCHSEC_SPECIAL_SW = 0x30, - TOUCHSEC_SPECIAL_SE = 0x40, + TOUCHSEC_SPECIAL_SW = 0x40, + TOUCHSEC_SPECIAL_SE = 0x80, } TouchScreenSection; enum {