diff src/video/ataricommon/SDL_xbiosevents.c @ 820:0b9b4bf3c1e7

Important crash fix: system vectors for mouse/joystick were not restored
author Patrice Mandin <patmandin@gmail.com>
date Sat, 14 Feb 2004 10:12:27 +0000
parents b8d311d90021
children a8068adf156b
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_xbiosevents.c	Sat Feb 14 06:04:41 2004 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents.c	Sat Feb 14 10:12:27 2004 +0000
@@ -31,8 +31,10 @@
  *	Patrice Mandin
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #include <mint/osbind.h>
 
 #include "SDL_events_c.h"
@@ -43,10 +45,13 @@
 
 int SDL_AtariXbios_enabled=0;
 
-static _KBDVECS *kbdvecs;		/* Pointer to access vectors */
-static _KBDVECS sys_kbdvecs;	/* Backup of system vectors */
+/* Local variables */
+
+static _KBDVECS *kbdvecs;		/* Pointer to access system vectors */
 static Uint16 atari_prevmouseb;	/* buttons */
 
+/* Functions */
+
 void SDL_AtariXbios_InstallVectors(int vectors_mask)
 {
 	void *oldpile;
@@ -64,10 +69,7 @@
 	/* Go to supervisor mode */
 	oldpile=(void *)Super(0);
 
-	/* Backup system vectors */
-	memcpy(&sys_kbdvecs, kbdvecs, sizeof(_KBDVECS));
-
-	/* Install our vector */
+	/* Install our vectors */
 	SDL_AtariXbios_Install(
 		kbdvecs,
 		(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
@@ -84,11 +86,14 @@
 {
 	void *oldpile;
 
+	/* Read IKBD vectors base */
+	kbdvecs=Kbdvbase();
+
 	/* Go to supervisor mode */
 	oldpile=(void *)Super(NULL);
 
 	/* Reinstall system vector */
-	SDL_AtariXbios_Install(kbdvecs,sys_kbdvecs.mousevec,sys_kbdvecs.joyvec);
+	SDL_AtariXbios_Restore(kbdvecs);
 
 	/* Back to user mode */
 	Super(oldpile);