From cecb5f9ad8e538b82df95c6c7fdd9826b016b05b Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Mon, 31 Aug 2026 14:28:01 +1000
Subject: [PATCH] atari:video:xbios: unsplit SetScreen() calls
SetScreen(-1, new_physbase, -1);
SetScreen(-1, -1, new_rez);
doesn't give us anything useful. VDI is re-initialized in every case
when parsing new_rez. The only exception is Falcon; here it makes sense
to do:
VsetScreen(-1, new_physbase, 3, -1);
VsetMode(new_mode);
And that doesn't re-initialize VDI. Also, TT doesn't need any special
treatment here, so re-use ST save/restore mode.
Btw, don't ever use:
old_rez = Getrez();
...
SetScreen(-1, -1, 0);
...
SetScreen(-1, -1, old_rez);
on Falcon (even if it works on ST perfectly) because it corrupts
internal variables. The only way to do it properly is:
old_mode = VsetMode(-1);
...
SetScreen(-1, -1, 0);
...
VsetScreen(-1, -1, 3, old_mode);
i.e. it is much easier just to have ST and Falcon branch in your video
code.
---
src/video/xbios/SDL_xbios_st.c | 8 ++------
src/video/xbios/SDL_xbios_tt.c | 15 ---------------
2 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/src/video/xbios/SDL_xbios_st.c b/src/video/xbios/SDL_xbios_st.c
index fc769723a..d9ac4aaa5 100644
--- a/src/video/xbios/SDL_xbios_st.c
+++ b/src/video/xbios/SDL_xbios_st.c
@@ -88,9 +88,7 @@ static void setMode_ST(_THIS, const xbiosmode_t *new_video_mode)
{
int i;
- Setscreen(-1,XBIOS_screens[0],-1);
-
- Setscreen(-1,-1,new_video_mode->number);
+ Setscreen(-1,XBIOS_screens[0],new_video_mode->number);
/* Reset palette, 8 shades of gray with a bit of green interleaved */
for (i=0;i<16;i++) {
@@ -103,9 +101,7 @@ static void setMode_STE(_THIS, const xbiosmode_t *new_video_mode)
{
int i;
- Setscreen(-1,XBIOS_screens[0],-1);
-
- Setscreen(-1,-1,new_video_mode->number);
+ Setscreen(-1,XBIOS_screens[0],new_video_mode->number);
/* Reset palette, 16 shades of gray */
for (i=0;i<16;i++) {
diff --git a/src/video/xbios/SDL_xbios_tt.c b/src/video/xbios/SDL_xbios_tt.c
index d93accc35..e6124edbb 100644
--- a/src/video/xbios/SDL_xbios_tt.c
+++ b/src/video/xbios/SDL_xbios_tt.c
@@ -41,17 +41,13 @@ static const xbiosmode_t ttmodes[]={
};
static void listModes(_THIS, int actually_add);
-static void saveMode(_THIS, SDL_PixelFormat *vformat);
static void setMode(_THIS, const xbiosmode_t *new_video_mode);
-static void restoreMode(_THIS);
static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
void SDL_XBIOS_VideoInit_TT(_THIS)
{
XBIOS_listModes = listModes;
- XBIOS_saveMode = saveMode;
XBIOS_setMode = setMode;
- XBIOS_restoreMode = restoreMode;
this->SetColors = setColors;
}
@@ -65,22 +61,11 @@ static void listModes(_THIS, int actually_add)
}
}
-static void saveMode(_THIS, SDL_PixelFormat *vformat)
-{
- XBIOS_oldvbase=Physbase();
- XBIOS_oldvmode=Getrez();
-}
-
static void setMode(_THIS, const xbiosmode_t *new_video_mode)
{
Setscreen(-1,XBIOS_screens[0],new_video_mode->number);
}
-static void restoreMode(_THIS)
-{
- Setscreen(-1,XBIOS_oldvbase,XBIOS_oldvmode);
-}
-
static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
{
int i, r,g,b;