Added hints to replace environment variables on the PlayStation Vita

This commit is contained in:
Sam Lantinga committed 2024-08-05 08:54:10 -07:00
1 parent 3669d1e76a
commit a97dadf779
6 files changed
+105 -19

No files matched your search

+4 -4
View File
@@ -46,13 +46,13 @@ static void getFBSize(int *width, int *height)
int VITA_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
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 target_path[MAX_PATH];
if (!skip_init) { // we don't care about actual value
if (override) {
if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_INIT, SDL_TRUE)) {
const char *override = SDL_GetHint(SDL_HINT_VITA_MODULE_PATH);
if (override && *override) {
default_path = override;
}
+3 -4
View File
@@ -35,14 +35,13 @@
int VITA_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
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";
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;
}
+5 -5
View File
@@ -41,13 +41,13 @@ struct
float range;
} force_info[SCE_TOUCH_PORT_MAX_NUM];
const char *disableFrontPoll = NULL;
const char *disableBackPoll = NULL;
static SDL_bool disableFrontPoll;
static SDL_bool disableBackPoll;
void VITA_InitTouch(void)
{
disableFrontPoll = SDL_getenv("VITA_DISABLE_TOUCH_FRONT");
disableBackPoll = SDL_getenv("VITA_DISABLE_TOUCH_BACK");
disableFrontPoll = !SDL_GetHintBoolean(SDL_HINT_VITA_ENABLE_FRONT_TOUCH, SDL_TRUE);
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_BACK, SCE_TOUCH_SAMPLING_STATE_START);
@@ -92,7 +92,7 @@ void VITA_PollTouch(void)
SDL_memcpy(touch_old, touch, sizeof(touch_old));
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)) {
continue;
}
+7 -6
View File
@@ -125,7 +125,7 @@ static SDL_VideoDevice *VITA_Create(void)
#if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR)
#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_CreateContext = VITA_GL_CreateContext;
device->GL_GetProcAddress = VITA_GL_GetProcAddress;
@@ -170,19 +170,19 @@ int VITA_VideoInit(SDL_VideoDevice *_this)
{
SDL_DisplayMode mode;
#ifdef SDL_VIDEO_VITA_PVR
const char *res = SDL_getenv("VITA_RESOLUTION");
const char *res = SDL_GetHint(SDL_HINT_VITA_RESOLUTION);
#endif
SDL_zero(mode);
#ifdef SDL_VIDEO_VITA_PVR
if (res) {
/* 1088i for PSTV (Or Sharpscale) */
if (!SDL_strncmp(res, "1080", 4)) {
if (SDL_strncmp(res, "1080", 4) == 0) {
mode.w = 1920;
mode.h = 1088;
}
/* 725p for PSTV (Or Sharpscale) */
else if (!SDL_strncmp(res, "720", 3)) {
else if (SDL_strncmp(res, "720", 3) == 0) {
mode.w = 1280;
mode.h = 725;
}
@@ -261,7 +261,8 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
win.windowSize = PSP2_WINDOW_960X544;
}
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 */
temp_major = _this->gl_config.major_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) {
return SDL_SetError("Could not create GLES window surface");
}
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
if (use_opengl) {
/* Revert */
_this->gl_config.major_version = temp_major;
_this->gl_config.minor_version = temp_minor;