[SDL3] [PS2] Framebuffer resolution + 240p/480p + PAL support (#13993)

* Do not override NTSC/PAL

* Fix PS2 build instructions

* Add PS2 GS hints
Allows for switching between NTSC/PAL, progressive/interlaced, etc

(cherry picked from commit 3fd0b46215)
(cherry picked from commit 7b28fb29bd)
This commit is contained in:
Fierelier
2025-09-21 14:50:14 +00:00
committed by Sam Lantinga
parent 7fe49da380
commit f172ee3d0e
3 changed files with 72 additions and 3 deletions

View File

@@ -624,8 +624,42 @@ static int PS2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, Uint32
gsGlobal = gsKit_init_global_custom(RENDER_QUEUE_OS_POOLSIZE, RENDER_QUEUE_PER_POOLSIZE);
gsGlobal->Mode = GS_MODE_NTSC;
gsGlobal->Height = 448;
// GS interlaced/progressive
if (SDL_GetHintBoolean(SDL_HINT_PS2_GS_PROGRESSIVE, false)) {
gsGlobal->Interlace = GS_NONINTERLACED;
} else {
gsGlobal->Interlace = GS_INTERLACED;
}
// GS width/height
gsGlobal->Width = 0;
gsGlobal->Height = 0;
const char *hint = SDL_GetHint(SDL_HINT_PS2_GS_WIDTH);
if (hint) {
gsGlobal->Width = SDL_atoi(hint);
}
hint = SDL_GetHint(SDL_HINT_PS2_GS_HEIGHT);
if (hint) {
gsGlobal->Height = SDL_atoi(hint);
}
if (gsGlobal->Width <= 0) {
gsGlobal->Width = 640;
}
if (gsGlobal->Height <= 0) {
gsGlobal->Height = 448;
}
// GS region
hint = SDL_GetHint(SDL_HINT_PS2_GS_MODE);
if (hint) {
if (SDL_strcasecmp(SDL_GetHint(SDL_HINT_PS2_GS_MODE), "NTSC") == 0) {
gsGlobal->Mode = GS_MODE_NTSC;
}
if (SDL_strcasecmp(SDL_GetHint(SDL_HINT_PS2_GS_MODE), "PAL") == 0) {
gsGlobal->Mode = GS_MODE_PAL;
}
}
gsGlobal->PSM = GS_PSM_CT24;
gsGlobal->PSMZ = GS_PSMZ_16S;