SDL-1.2: atari:events: remove gemdos events driver

From ac0cbcd8efae74dc27173a41b8403d93f430eb21 Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Thu, 27 Jun 2024 23:11:08 +0200
Subject: [PATCH] atari:events: remove gemdos events driver

Replaced in favor of xbios driver.
---
 README.MiNT                                |  12 +-
 src/video/ataricommon/SDL_atarievents.c    |  13 +-
 src/video/ataricommon/SDL_gemdosevents.c   | 138 ---------------------
 src/video/ataricommon/SDL_gemdosevents_c.h |  42 -------
 4 files changed, 9 insertions(+), 196 deletions(-)
 delete mode 100644 src/video/ataricommon/SDL_gemdosevents.c
 delete mode 100644 src/video/ataricommon/SDL_gemdosevents_c.h

diff --git a/README.MiNT b/README.MiNT
index a10486bd8..45482673a 100644
--- a/README.MiNT
+++ b/README.MiNT
@@ -49,7 +49,7 @@ III.  Enjoy! :)
 ==============================================================================
 IV.  What is supported:
 
-Keyboard (GEMDOS, GEM, Ikbd)
+Keyboard (XBIOS, GEM, Ikbd)
 Mouse (XBIOS, GEM, Ikbd)
 Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
 Timer (Timer C interrupt, GNU pth library)
@@ -63,7 +63,7 @@ OpenGL (using Mesa offscreen rendering driver)
 - Dependent driver combinations:
 Video   Kbd     Mouse   Joysticks
 xbios   ikbd    ikbd    ikbd
-xbios   gemdos  xbios   xbios
+xbios   xbios   xbios   xbios
 gem     gem     gem(1)  xbios
 
 Audio   O/S     Misc
@@ -108,7 +108,7 @@ SDL_AUDIODRIVER:
 
 SDL_ATARI_EVENTSDRIVER
 	Set to 'ikbd' to force IKBD 6301 keyboard driver
-	Set to 'gemdos' to force gemdos keyboard driver
+	Set to 'xbios' to force xbios keyboard driver
 
 SDL_JOYSTICK_ATARI:
 	Use any of these strings in the environment variable to enable or
@@ -128,7 +128,7 @@ SDL_JOYSTICK_ATARI:
 
 	Default configuration is:
 		'ikbd-joy1-on' (if IKBD events driver enabled)
-		'xbios-joy1-on' (if gemdos/gem events driver enabled)
+		'xbios-joy1-on' (if xbios/gem events driver enabled)
 		'porta-pad-on portb-pad-on' (if available on the machine)
 
 	port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
@@ -204,8 +204,8 @@ IKBD keyboard, mouse and joystick driver:
 	Hades has an IKBD, but xbios is not available for video, so IKBD driver is
 	disabled.
 
-Gemdos keyboard driver:
-	Available on all machines. Gemdos driver is default for non-Atari machines.
+XBIOS keyboard driver:
+	Available on all machines with TOS >= 2.x. XBIOS driver is default for non-Atari machines.
 
 Mouse and joystick xbios driver:
 	Available on all machines (I think).
diff --git a/src/video/ataricommon/SDL_atarievents.c b/src/video/ataricommon/SDL_atarievents.c
index 738c81600..b29f2e037 100644
--- a/src/video/ataricommon/SDL_atarievents.c
+++ b/src/video/ataricommon/SDL_atarievents.c
@@ -39,7 +39,6 @@
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
 #include "SDL_xbiosevents_c.h"
-#include "SDL_gemdosevents_c.h"
 #include "SDL_ikbdevents_c.h"
 
 /* from src/audio/mint/SDL_mintaudio.c */
@@ -88,9 +87,9 @@ static void Atari_InitializeEvents(_THIS)
 			Atari_ShutdownEvents=AtariIkbd_ShutdownEvents;
 			break;
 		default:
-			this->InitOSKeymap=AtariGemdos_InitOSKeymap;
-			this->PumpEvents=AtariGemdos_PumpEvents;
-			Atari_ShutdownEvents=AtariGemdos_ShutdownEvents;
+			this->InitOSKeymap=AtariXbios_InitOSKeymap;
+			this->PumpEvents=AtariXbios_PumpEvents;
+			Atari_ShutdownEvents=AtariXbios_ShutdownEvents;
 			break;
 	}
 
@@ -106,12 +105,6 @@ static void Atari_InitializeEvents(_THIS)
 		Atari_ShutdownEvents=AtariIkbd_ShutdownEvents;
 	}
 
-	if (SDL_strcmp(envr, "gemdos") == 0) {
-		this->InitOSKeymap=AtariGemdos_InitOSKeymap;
-		this->PumpEvents=AtariGemdos_PumpEvents;
-		Atari_ShutdownEvents=AtariGemdos_ShutdownEvents;
-	}
-
 	if (SDL_strcmp(envr, "xbios") == 0) {
 		this->InitOSKeymap=AtariXbios_InitOSKeymap;
 		this->PumpEvents=AtariXbios_PumpEvents;
diff --git a/src/video/ataricommon/SDL_gemdosevents.c b/src/video/ataricommon/SDL_gemdosevents.c
deleted file mode 100644
index 164629599..000000000
--- a/src/video/ataricommon/SDL_gemdosevents.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2012 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- *	Atari keyboard events manager, using Gemdos
- *
- *	Patrice Mandin
- */
-
-/* Mint includes */
-#include <mint/osbind.h>
-#include <mint/cookie.h>
-
-#include "../../events/SDL_sysevents.h"
-#include "../../events/SDL_events_c.h"
-
-#include "SDL_atarikeys.h"
-#include "SDL_atarievents_c.h"
-#include "SDL_xbiosevents_c.h"
-
-/* To save state of keyboard */
-
-static unsigned char gemdos_currentkeyboard[ATARIBIOS_MAXKEYS];
-static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS];
-
-static void UpdateSpecialKeys(int special_keys_state);
-
-void AtariGemdos_InitOSKeymap(_THIS)
-{
-	int vectors_mask;
-/*	unsigned long dummy;*/
-
-	SDL_memset(gemdos_currentkeyboard, 0, sizeof(gemdos_currentkeyboard));
-	SDL_memset(gemdos_previouskeyboard, 0, sizeof(gemdos_previouskeyboard));
-
-	vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;	/* XBIOS joystick events */
-	vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;	/* XBIOS mouse events */
-
-	SDL_AtariXbios_InstallVectors(vectors_mask);
-}
-
-void AtariGemdos_PumpEvents(_THIS)
-{
-	int i;
-	SDL_keysym keysym;
-	short kstate;
-
-	SDL_AtariMint_BackgroundTasks();
-
-	/* Update pressed keys */
-	SDL_memset(gemdos_currentkeyboard, 0, ATARIBIOS_MAXKEYS);
-
-	while (Cconis()!=DEV_BUSY) {
-		unsigned long key_pressed;
-		key_pressed=Cnecin();
-		gemdos_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
-	}
-
-	/* Read special keys */
-	kstate = Kbshift(-1);
-	UpdateSpecialKeys(kstate);
-
-	/* Now generate events */
-	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
-		/* Key pressed ? */
-		if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i]) {
-			SDL_PrivateKeyboard(SDL_PRESSED,
-				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE, kstate));
-			if (i == SCANCODE_CAPSLOCK) {
-				/* Pressed capslock: generate a release event, too because this
-				 * is what SDL expects; it handles locking by itself.
-				 */
-				SDL_PrivateKeyboard(SDL_RELEASED,
-					SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE, kstate & ~K_CAPSLOCK));
-			}
-		}
-
-		/* Key unpressed ? */
-		if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i]) {
-			if (i == SCANCODE_CAPSLOCK) {
-				/* Released capslock: generate a pressed event, too because this
-				 * is what SDL expects; it handles locking by itself.
-				 */
-				SDL_PrivateKeyboard(SDL_PRESSED,
-					SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE, kstate | K_CAPSLOCK));
-			}
-			SDL_PrivateKeyboard(SDL_RELEASED,
-				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE, kstate));
-		}
-	}
-
-	SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
-
-	/* Will be previous table */
-	SDL_memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard, sizeof(gemdos_previouskeyboard));
-}
-
-static void UpdateSpecialKeys(int special_keys_state)
-{
-#define UPDATE_SPECIAL_KEYS(mask,scancode) \
-	{	\
-		if (special_keys_state & mask) { \
-			gemdos_currentkeyboard[scancode]=0xFF; \
-		}	\
-	}
-
-	UPDATE_SPECIAL_KEYS(K_RSHIFT, SCANCODE_RIGHTSHIFT);
-	UPDATE_SPECIAL_KEYS(K_LSHIFT, SCANCODE_LEFTSHIFT);
-	UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL);
-	UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT);
-	UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
-	UPDATE_SPECIAL_KEYS(0x80, SCANCODE_ALTGR);
-}
-
-void AtariGemdos_ShutdownEvents(void)
-{
-	SDL_AtariXbios_RestoreVectors();
-}
diff --git a/src/video/ataricommon/SDL_gemdosevents_c.h b/src/video/ataricommon/SDL_gemdosevents_c.h
deleted file mode 100644
index b9924e63a..000000000
--- a/src/video/ataricommon/SDL_gemdosevents_c.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2012 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- *	Atari keyboard events manager, using Gemdos
- *
- *	Patrice Mandin
- */
-
-#ifndef _SDL_ATARI_GEMDOSEVENTS_H_
-#define _SDL_ATARI_GEMDOSEVENTS_H_
-
-#include "../SDL_sysvideo.h"
-
-/* Hidden "this" pointer for the video functions */
-#define _THIS	SDL_VideoDevice *this
-
-extern void AtariGemdos_InitOSKeymap(_THIS);
-extern void AtariGemdos_PumpEvents(_THIS);
-extern void AtariGemdos_ShutdownEvents(void);
-
-#endif /* _SDL_ATARI_GEMDOSEVENTS_H_ */