[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
This commit is contained in:
Fierelier
2025-09-21 14:50:14 +00:00
committed by GitHub
parent bce2a336d2
commit 3fd0b46215
3 changed files with 74 additions and 3 deletions

View File

@@ -655,8 +655,42 @@ static bool PS2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
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;