mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-10-07 10:53:31 +00:00
OpenXR - Default device config added
This commit is contained in:
parent
8c9fd584b3
commit
8f2904ecac
@ -45,6 +45,7 @@ enum SystemDeviceType {
|
||||
DEVICE_TYPE_MOBILE = 0, // phones and pads
|
||||
DEVICE_TYPE_TV = 1, // Android TV and similar
|
||||
DEVICE_TYPE_DESKTOP = 2, // Desktop computer
|
||||
DEVICE_TYPE_VR = 3, // VR headset
|
||||
};
|
||||
|
||||
enum SystemKeyboardLayout {
|
||||
|
@ -682,6 +682,10 @@ const char * const vulkanDefaultBlacklist[] = {
|
||||
};
|
||||
|
||||
static int DefaultGPUBackend() {
|
||||
#ifdef OPENXR
|
||||
return (int)GPUBackend::OPENGL;
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
// If no Vulkan, use Direct3D 11 on Windows 8+ (most importantly 10.)
|
||||
if (DoesVersionMatchWindows(6, 2, 0, 0, true)) {
|
||||
@ -843,11 +847,7 @@ static ConfigSetting graphicsSettings[] = {
|
||||
ConfigSetting("CardboardXShift", &g_Config.iCardboardXShift, 0, true, true),
|
||||
ConfigSetting("CardboardYShift", &g_Config.iCardboardYShift, 0, true, true),
|
||||
ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0, true, true),
|
||||
#ifdef OPENXR
|
||||
g_Config.iGPUBackend = (int)GPUBackend::OPENGL,
|
||||
#else
|
||||
ReportedConfigSetting("GraphicsBackend", &g_Config.iGPUBackend, &DefaultGPUBackend, &GPUBackendTranslator::To, &GPUBackendTranslator::From, true, false),
|
||||
#endif
|
||||
ConfigSetting("FailedGraphicsBackends", &g_Config.sFailedGPUBackends, ""),
|
||||
ConfigSetting("DisabledGraphicsBackends", &g_Config.sDisabledGPUBackends, ""),
|
||||
ConfigSetting("VulkanDevice", &g_Config.sVulkanDevice, "", true, false),
|
||||
@ -960,6 +960,8 @@ static bool DefaultShowTouchControls() {
|
||||
return false;
|
||||
} else if (deviceType == DEVICE_TYPE_DESKTOP) {
|
||||
return false;
|
||||
} else if (deviceType == DEVICE_TYPE_VR) {
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -998,11 +1000,7 @@ static ConfigSetting controlSettings[] = {
|
||||
ConfigSetting("IgnoreWindowsKey", &g_Config.bIgnoreWindowsKey, false, true, true),
|
||||
#endif
|
||||
|
||||
#ifdef OPENXR
|
||||
g_Config.bShowTouchControls = false,
|
||||
#else
|
||||
ConfigSetting("ShowTouchControls", &g_Config.bShowTouchControls, &DefaultShowTouchControls, true, true),
|
||||
#endif
|
||||
|
||||
// ConfigSetting("KeyMapping", &g_Config.iMappingMap, 0),
|
||||
|
||||
|
@ -654,6 +654,11 @@ void SetAxisMapping(int btn, int deviceId, int axisId, int direction, bool repla
|
||||
void RestoreDefault() {
|
||||
g_controllerMap.clear();
|
||||
g_controllerMapGeneration++;
|
||||
#ifdef OPENXR
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_VR_HEADSET, false);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_XINPUT, false);
|
||||
|
@ -309,6 +309,28 @@ static const DefMappingStruct defaultXperiaPlay[] = {
|
||||
{VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, +1},
|
||||
};
|
||||
|
||||
static const DefMappingStruct defaultVRLeftController[] = {
|
||||
{CTRL_UP , NKCODE_DPAD_UP},
|
||||
{CTRL_DOWN , NKCODE_DPAD_DOWN},
|
||||
{CTRL_LEFT , NKCODE_DPAD_LEFT},
|
||||
{CTRL_RIGHT , NKCODE_DPAD_RIGHT},
|
||||
{CTRL_SELECT , NKCODE_BUTTON_THUMBL},
|
||||
{CTRL_LTRIGGER , NKCODE_BUTTON_X},
|
||||
{CTRL_RTRIGGER , NKCODE_BUTTON_Y},
|
||||
};
|
||||
|
||||
static const DefMappingStruct defaultVRRightController[] = {
|
||||
{CTRL_CIRCLE , NKCODE_ALT_RIGHT},
|
||||
{CTRL_CROSS , NKCODE_ENTER},
|
||||
{CTRL_SQUARE , NKCODE_BUTTON_B},
|
||||
{CTRL_TRIANGLE , NKCODE_BUTTON_A},
|
||||
{CTRL_START , NKCODE_BUTTON_THUMBR},
|
||||
{VIRTKEY_AXIS_Y_MAX, NKCODE_DPAD_UP},
|
||||
{VIRTKEY_AXIS_Y_MIN, NKCODE_DPAD_DOWN},
|
||||
{VIRTKEY_AXIS_X_MIN, NKCODE_DPAD_LEFT},
|
||||
{VIRTKEY_AXIS_X_MAX, NKCODE_DPAD_RIGHT},
|
||||
};
|
||||
|
||||
static void SetDefaultKeyMap(int deviceId, const DefMappingStruct *array, size_t count, bool replace) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (array[i].direction == 0)
|
||||
@ -365,6 +387,10 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) {
|
||||
case DEFAULT_MAPPING_RETRO_STATION_CONTROLLER:
|
||||
SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultRetroStationControllerMap, ARRAY_SIZE(defaultRetroStationControllerMap), replace);
|
||||
break;
|
||||
case DEFAULT_MAPPING_VR_HEADSET:
|
||||
SetDefaultKeyMap(DEVICE_ID_XR_CONTROLLER_LEFT, defaultVRLeftController, ARRAY_SIZE(defaultVRLeftController), replace);
|
||||
SetDefaultKeyMap(DEVICE_ID_XR_CONTROLLER_RIGHT, defaultVRRightController, ARRAY_SIZE(defaultVRRightController), replace);
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateNativeMenuKeys();
|
||||
|
@ -13,6 +13,7 @@ enum DefaultMaps {
|
||||
DEFAULT_MAPPING_XPERIA_PLAY,
|
||||
DEFAULT_MAPPING_MOQI_I7S,
|
||||
DEFAULT_MAPPING_RETRO_STATION_CONTROLLER,
|
||||
DEFAULT_MAPPING_VR_HEADSET,
|
||||
};
|
||||
|
||||
void SetDefaultKeyMap(DefaultMaps dmap, bool replace);
|
||||
|
@ -115,8 +115,8 @@ struct ButtonMapping
|
||||
};
|
||||
|
||||
std::vector<ButtonMapping> leftControllerMapping = {
|
||||
ButtonMapping(NKCODE_X, ovrButton_X),
|
||||
ButtonMapping(NKCODE_Y, ovrButton_Y),
|
||||
ButtonMapping(NKCODE_BUTTON_X, ovrButton_X),
|
||||
ButtonMapping(NKCODE_BUTTON_Y, ovrButton_Y),
|
||||
ButtonMapping(NKCODE_ALT_LEFT, ovrButton_GripTrigger),
|
||||
ButtonMapping(NKCODE_DPAD_UP, ovrButton_Up),
|
||||
ButtonMapping(NKCODE_DPAD_DOWN, ovrButton_Down),
|
||||
@ -128,8 +128,8 @@ std::vector<ButtonMapping> leftControllerMapping = {
|
||||
};
|
||||
|
||||
std::vector<ButtonMapping> rightControllerMapping = {
|
||||
ButtonMapping(NKCODE_A, ovrButton_A),
|
||||
ButtonMapping(NKCODE_B, ovrButton_B),
|
||||
ButtonMapping(NKCODE_BUTTON_A, ovrButton_A),
|
||||
ButtonMapping(NKCODE_BUTTON_B, ovrButton_B),
|
||||
ButtonMapping(NKCODE_ALT_RIGHT, ovrButton_GripTrigger),
|
||||
ButtonMapping(NKCODE_DPAD_UP, ovrButton_Up),
|
||||
ButtonMapping(NKCODE_DPAD_DOWN, ovrButton_Down),
|
||||
@ -696,6 +696,9 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init
|
||||
renderer_inited = false;
|
||||
androidVersion = jAndroidVersion;
|
||||
deviceType = jdeviceType;
|
||||
#ifdef OPENXR
|
||||
deviceType = DEVICE_TYPE_VR;
|
||||
#endif
|
||||
|
||||
left_joystick_x_async = 0;
|
||||
left_joystick_y_async = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user