mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-17 18:28:28 +00:00
Added hints to replace environment variables on the PlayStation Vita
This commit is contained in:
parent
3669d1e76a
commit
a97dadf779
6 changed files with 105 additions and 19 deletions
|
@ -812,6 +812,12 @@ The following environment variables have been removed:
|
||||||
* SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE
|
* SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE
|
||||||
* SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE
|
* SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE
|
||||||
* SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay.
|
* SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay.
|
||||||
|
* VITA_DISABLE_TOUCH_BACK - replaced with the hint SDL_HINT_VITA_ENABLE_BACK_TOUCH
|
||||||
|
* VITA_DISABLE_TOUCH_FRONT - replaced with the hint SDL_HINT_VITA_ENABLE_FRONT_TOUCH
|
||||||
|
* VITA_MODULE_PATH - replaced with the hint SDL_HINT_VITA_MODULE_PATH
|
||||||
|
* VITA_PVR_OGL - replaced with the hint SDL_HINT_VITA_PVR_OPENGL
|
||||||
|
* VITA_PVR_SKIP_INIT - replaced with the hint SDL_HINT_VITA_PVR_INIT
|
||||||
|
* VITA_RESOLUTION - replaced with the hint SDL_HINT_VITA_RESOLUTION
|
||||||
|
|
||||||
The following functions have been removed:
|
The following functions have been removed:
|
||||||
* SDL_ClearHints() - replaced with SDL_ResetHints()
|
* SDL_ClearHints() - replaced with SDL_ResetHints()
|
||||||
|
|
|
@ -3357,6 +3357,86 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling whether touch should be enabled on the back panel of the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
*
|
||||||
|
* - "0": Disable touch on the back panel.
|
||||||
|
* - "1": Enable touch on the back panel. (default)
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_ENABLE_BACK_TOUCH "SDL_VITA_ENABLE_BACK_TOUCH"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling whether touch should be enabled on the front panel of the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
*
|
||||||
|
* - "0": Disable touch on the front panel.
|
||||||
|
* - "1": Enable touch on the front panel. (default)
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_ENABLE_FRONT_TOUCH "SDL_VITA_ENABLE_FRONT_TOUCH"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling the module path on the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* This hint defaults to "app0:module"
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_MODULE_PATH "SDL_VITA_MODULE_PATH"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling whether to perform PVR initialization on the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* - "0": Skip PVR initialization.
|
||||||
|
* - "1": Perform the normal PVR initialization. (default)
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_PVR_INIT "SDL_VITA_PVR_INIT"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable overriding the resolution reported on the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
*
|
||||||
|
* - "544": 544p (default)
|
||||||
|
* - "720": 725p for PSTV
|
||||||
|
* - "1080": 1088i for PSTV
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_RESOLUTION "SDL_VITA_RESOLUTION"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling whether OpenGL should be used instead of OpenGL ES on the PlayStation Vita.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
*
|
||||||
|
* - "0": Use OpenGL ES. (default)
|
||||||
|
* - "1": Use OpenGL.
|
||||||
|
*
|
||||||
|
* This hint should be set before SDL is initialized.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.0.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VITA_PVR_OPENGL "SDL_VITA_PVR_OPENGL"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A variable controlling which touchpad should generate synthetic mouse
|
* A variable controlling which touchpad should generate synthetic mouse
|
||||||
* events.
|
* events.
|
||||||
|
|
|
@ -46,13 +46,13 @@ static void getFBSize(int *width, int *height)
|
||||||
int VITA_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
int VITA_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
{
|
{
|
||||||
PVRSRV_PSP2_APPHINT hint;
|
PVRSRV_PSP2_APPHINT hint;
|
||||||
const char *override = SDL_getenv("VITA_MODULE_PATH");
|
|
||||||
const char *skip_init = SDL_getenv("VITA_PVR_SKIP_INIT");
|
|
||||||
char *default_path = "app0:module";
|
char *default_path = "app0:module";
|
||||||
char target_path[MAX_PATH];
|
char target_path[MAX_PATH];
|
||||||
|
|
||||||
if (!skip_init) { // we don't care about actual value
|
if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_INIT, SDL_TRUE)) {
|
||||||
if (override) {
|
const char *override = SDL_GetHint(SDL_HINT_VITA_MODULE_PATH);
|
||||||
|
|
||||||
|
if (override && *override) {
|
||||||
default_path = override;
|
default_path = override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,13 @@
|
||||||
int VITA_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
int VITA_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
{
|
{
|
||||||
PVRSRV_PSP2_APPHINT hint;
|
PVRSRV_PSP2_APPHINT hint;
|
||||||
const char *override = SDL_getenv("VITA_MODULE_PATH");
|
|
||||||
const char *skip_init = SDL_getenv("VITA_PVR_SKIP_INIT");
|
|
||||||
const char *default_path = "app0:module";
|
const char *default_path = "app0:module";
|
||||||
char target_path[MAX_PATH];
|
char target_path[MAX_PATH];
|
||||||
|
|
||||||
if (!skip_init) { // we don't care about actual value
|
if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_INIT, SDL_TRUE)) {
|
||||||
|
const char *override = SDL_GetHint(SDL_HINT_VITA_MODULE_PATH);
|
||||||
|
|
||||||
if (override) {
|
if (override && *override) {
|
||||||
default_path = override;
|
default_path = override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,13 @@ struct
|
||||||
float range;
|
float range;
|
||||||
} force_info[SCE_TOUCH_PORT_MAX_NUM];
|
} force_info[SCE_TOUCH_PORT_MAX_NUM];
|
||||||
|
|
||||||
const char *disableFrontPoll = NULL;
|
static SDL_bool disableFrontPoll;
|
||||||
const char *disableBackPoll = NULL;
|
static SDL_bool disableBackPoll;
|
||||||
|
|
||||||
void VITA_InitTouch(void)
|
void VITA_InitTouch(void)
|
||||||
{
|
{
|
||||||
disableFrontPoll = SDL_getenv("VITA_DISABLE_TOUCH_FRONT");
|
disableFrontPoll = !SDL_GetHintBoolean(SDL_HINT_VITA_ENABLE_FRONT_TOUCH, SDL_TRUE);
|
||||||
disableBackPoll = SDL_getenv("VITA_DISABLE_TOUCH_BACK");
|
disableBackPoll = !SDL_GetHintBoolean(SDL_HINT_VITA_ENABLE_BACK_TOUCH, SDL_TRUE);
|
||||||
|
|
||||||
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
|
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
|
||||||
sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
|
sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
|
||||||
|
@ -92,7 +92,7 @@ void VITA_PollTouch(void)
|
||||||
SDL_memcpy(touch_old, touch, sizeof(touch_old));
|
SDL_memcpy(touch_old, touch, sizeof(touch_old));
|
||||||
|
|
||||||
for (port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
|
for (port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
|
||||||
/** Skip polling of Touch Device if environment variable is set **/
|
/** Skip polling of Touch Device if hint is set **/
|
||||||
if (((port == 0) && disableFrontPoll) || ((port == 1) && disableBackPoll)) {
|
if (((port == 0) && disableFrontPoll) || ((port == 1) && disableBackPoll)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ static SDL_VideoDevice *VITA_Create(void)
|
||||||
|
|
||||||
#if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR)
|
#if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR)
|
||||||
#ifdef SDL_VIDEO_VITA_PVR_OGL
|
#ifdef SDL_VIDEO_VITA_PVR_OGL
|
||||||
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
|
if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_OPENGL, SDL_FALSE)) {
|
||||||
device->GL_LoadLibrary = VITA_GL_LoadLibrary;
|
device->GL_LoadLibrary = VITA_GL_LoadLibrary;
|
||||||
device->GL_CreateContext = VITA_GL_CreateContext;
|
device->GL_CreateContext = VITA_GL_CreateContext;
|
||||||
device->GL_GetProcAddress = VITA_GL_GetProcAddress;
|
device->GL_GetProcAddress = VITA_GL_GetProcAddress;
|
||||||
|
@ -170,19 +170,19 @@ int VITA_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
#ifdef SDL_VIDEO_VITA_PVR
|
#ifdef SDL_VIDEO_VITA_PVR
|
||||||
const char *res = SDL_getenv("VITA_RESOLUTION");
|
const char *res = SDL_GetHint(SDL_HINT_VITA_RESOLUTION);
|
||||||
#endif
|
#endif
|
||||||
SDL_zero(mode);
|
SDL_zero(mode);
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_VITA_PVR
|
#ifdef SDL_VIDEO_VITA_PVR
|
||||||
if (res) {
|
if (res) {
|
||||||
/* 1088i for PSTV (Or Sharpscale) */
|
/* 1088i for PSTV (Or Sharpscale) */
|
||||||
if (!SDL_strncmp(res, "1080", 4)) {
|
if (SDL_strncmp(res, "1080", 4) == 0) {
|
||||||
mode.w = 1920;
|
mode.w = 1920;
|
||||||
mode.h = 1088;
|
mode.h = 1088;
|
||||||
}
|
}
|
||||||
/* 725p for PSTV (Or Sharpscale) */
|
/* 725p for PSTV (Or Sharpscale) */
|
||||||
else if (!SDL_strncmp(res, "720", 3)) {
|
else if (SDL_strncmp(res, "720", 3) == 0) {
|
||||||
mode.w = 1280;
|
mode.w = 1280;
|
||||||
mode.h = 725;
|
mode.h = 725;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,8 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
|
||||||
win.windowSize = PSP2_WINDOW_960X544;
|
win.windowSize = PSP2_WINDOW_960X544;
|
||||||
}
|
}
|
||||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||||
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
|
SDL_bool use_opengl = SDL_GetHintBoolean(SDL_HINT_VITA_PVR_OPENGL, SDL_FALSE);
|
||||||
|
if (use_opengl) {
|
||||||
/* Set version to 2.1 and PROFILE to ES */
|
/* Set version to 2.1 and PROFILE to ES */
|
||||||
temp_major = _this->gl_config.major_version;
|
temp_major = _this->gl_config.major_version;
|
||||||
temp_minor = _this->gl_config.minor_version;
|
temp_minor = _this->gl_config.minor_version;
|
||||||
|
@ -275,7 +276,7 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
|
||||||
if (wdata->egl_surface == EGL_NO_SURFACE) {
|
if (wdata->egl_surface == EGL_NO_SURFACE) {
|
||||||
return SDL_SetError("Could not create GLES window surface");
|
return SDL_SetError("Could not create GLES window surface");
|
||||||
}
|
}
|
||||||
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
|
if (use_opengl) {
|
||||||
/* Revert */
|
/* Revert */
|
||||||
_this->gl_config.major_version = temp_major;
|
_this->gl_config.major_version = temp_major;
|
||||||
_this->gl_config.minor_version = temp_minor;
|
_this->gl_config.minor_version = temp_minor;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue