Commit bdc7c65e authored by Patrice Mandin's avatar Patrice Mandin

Important crash fix: system vectors for mouse/joystick were not restored

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40821
parent 0776f6fd
......@@ -31,8 +31,10 @@ static char rcsid =
* Patrice Mandin
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mint/osbind.h>
#include "SDL_events_c.h"
......@@ -43,10 +45,13 @@ static char rcsid =
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 @@ void SDL_AtariXbios_InstallVectors(int vectors_mask)
/* 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 SDL_AtariXbios_RestoreVectors(void)
{
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);
......
......@@ -34,6 +34,7 @@ static char rcsid =
.text
.globl _SDL_AtariXbios_Install
.globl _SDL_AtariXbios_Restore
.globl _SDL_AtariXbios_MouseVector
.globl _SDL_AtariXbios_JoystickVector
......@@ -53,6 +54,7 @@ _SDL_AtariXbios_Install:
/* Save old mouse vector, set our routine */
clrl oldmousevector
movel sp@(8),d0
beqs no_new_mouse_vector
movel a0@(16),oldmousevector
......@@ -61,6 +63,7 @@ no_new_mouse_vector:
/* Save old joystick vector, set our routine */
clrl oldjoystickvector
movel sp@(12),d0
beqs no_new_joystick_vector
movel a0@(24),oldjoystickvector
......@@ -73,6 +76,35 @@ no_new_joystick_vector:
rts
/*--- Vector restorer ---*/
_SDL_AtariXbios_Restore:
movel sp@(4),a0
/* Stop interrupts */
movew #0x2700,sr
/* Restore mouse vector */
movel oldmousevector,d0
beqs no_restore_mouse
movel d0,a0@(16)
no_restore_mouse:
/* Restore joystick vector */
movel oldjoystickvector,d0
beqs no_restore_joystick
movel d0,a0@(24)
no_restore_joystick:
/* Restart interrupts */
movew #0x2300,sr
rts
/*--- Our mouse vector ---*/
.text
......@@ -138,4 +170,3 @@ _SDL_AtariXbios_JoystickVector:
.data
.even
.comm _SDL_AtariXbios_joystick,2*1
......@@ -48,6 +48,7 @@ extern Uint16 SDL_AtariXbios_joystick; /* Joystick */
/* Functions */
extern void SDL_AtariXbios_Install(_KBDVECS *kbdvecs,void *newmousevector,void *newjoystickvector);
extern void SDL_AtariXbios_Restore(_KBDVECS *kbdvecs);
extern void SDL_AtariXbios_MouseVector(void *buf);
extern void SDL_AtariXbios_JoystickVector(void *buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment