Important crash fix: system vectors for mouse/joystick were not restored
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40821
This commit is contained in:
parent
0776f6fd31
commit
bdc7c65e1a
3 changed files with 45 additions and 8 deletions
|
@ -31,8 +31,10 @@ static char rcsid =
|
||||||
* Patrice Mandin
|
* Patrice Mandin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mint/osbind.h>
|
#include <mint/osbind.h>
|
||||||
|
|
||||||
#include "SDL_events_c.h"
|
#include "SDL_events_c.h"
|
||||||
|
@ -43,10 +45,13 @@ static char rcsid =
|
||||||
|
|
||||||
int SDL_AtariXbios_enabled=0;
|
int SDL_AtariXbios_enabled=0;
|
||||||
|
|
||||||
static _KBDVECS *kbdvecs; /* Pointer to access vectors */
|
/* Local variables */
|
||||||
static _KBDVECS sys_kbdvecs; /* Backup of system vectors */
|
|
||||||
|
static _KBDVECS *kbdvecs; /* Pointer to access system vectors */
|
||||||
static Uint16 atari_prevmouseb; /* buttons */
|
static Uint16 atari_prevmouseb; /* buttons */
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
|
||||||
void SDL_AtariXbios_InstallVectors(int vectors_mask)
|
void SDL_AtariXbios_InstallVectors(int vectors_mask)
|
||||||
{
|
{
|
||||||
void *oldpile;
|
void *oldpile;
|
||||||
|
@ -64,10 +69,7 @@ void SDL_AtariXbios_InstallVectors(int vectors_mask)
|
||||||
/* Go to supervisor mode */
|
/* Go to supervisor mode */
|
||||||
oldpile=(void *)Super(0);
|
oldpile=(void *)Super(0);
|
||||||
|
|
||||||
/* Backup system vectors */
|
/* Install our vectors */
|
||||||
memcpy(&sys_kbdvecs, kbdvecs, sizeof(_KBDVECS));
|
|
||||||
|
|
||||||
/* Install our vector */
|
|
||||||
SDL_AtariXbios_Install(
|
SDL_AtariXbios_Install(
|
||||||
kbdvecs,
|
kbdvecs,
|
||||||
(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
|
(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
|
||||||
|
@ -84,11 +86,14 @@ void SDL_AtariXbios_RestoreVectors(void)
|
||||||
{
|
{
|
||||||
void *oldpile;
|
void *oldpile;
|
||||||
|
|
||||||
|
/* Read IKBD vectors base */
|
||||||
|
kbdvecs=Kbdvbase();
|
||||||
|
|
||||||
/* Go to supervisor mode */
|
/* Go to supervisor mode */
|
||||||
oldpile=(void *)Super(NULL);
|
oldpile=(void *)Super(NULL);
|
||||||
|
|
||||||
/* Reinstall system vector */
|
/* Reinstall system vector */
|
||||||
SDL_AtariXbios_Install(kbdvecs,sys_kbdvecs.mousevec,sys_kbdvecs.joyvec);
|
SDL_AtariXbios_Restore(kbdvecs);
|
||||||
|
|
||||||
/* Back to user mode */
|
/* Back to user mode */
|
||||||
Super(oldpile);
|
Super(oldpile);
|
||||||
|
|
|
@ -34,6 +34,7 @@ static char rcsid =
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.globl _SDL_AtariXbios_Install
|
.globl _SDL_AtariXbios_Install
|
||||||
|
.globl _SDL_AtariXbios_Restore
|
||||||
.globl _SDL_AtariXbios_MouseVector
|
.globl _SDL_AtariXbios_MouseVector
|
||||||
.globl _SDL_AtariXbios_JoystickVector
|
.globl _SDL_AtariXbios_JoystickVector
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ _SDL_AtariXbios_Install:
|
||||||
|
|
||||||
/* Save old mouse vector, set our routine */
|
/* Save old mouse vector, set our routine */
|
||||||
|
|
||||||
|
clrl oldmousevector
|
||||||
movel sp@(8),d0
|
movel sp@(8),d0
|
||||||
beqs no_new_mouse_vector
|
beqs no_new_mouse_vector
|
||||||
movel a0@(16),oldmousevector
|
movel a0@(16),oldmousevector
|
||||||
|
@ -61,6 +63,7 @@ no_new_mouse_vector:
|
||||||
|
|
||||||
/* Save old joystick vector, set our routine */
|
/* Save old joystick vector, set our routine */
|
||||||
|
|
||||||
|
clrl oldjoystickvector
|
||||||
movel sp@(12),d0
|
movel sp@(12),d0
|
||||||
beqs no_new_joystick_vector
|
beqs no_new_joystick_vector
|
||||||
movel a0@(24),oldjoystickvector
|
movel a0@(24),oldjoystickvector
|
||||||
|
@ -73,6 +76,35 @@ no_new_joystick_vector:
|
||||||
|
|
||||||
rts
|
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 ---*/
|
/*--- Our mouse vector ---*/
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
@ -138,4 +170,3 @@ _SDL_AtariXbios_JoystickVector:
|
||||||
.data
|
.data
|
||||||
.even
|
.even
|
||||||
.comm _SDL_AtariXbios_joystick,2*1
|
.comm _SDL_AtariXbios_joystick,2*1
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern Uint16 SDL_AtariXbios_joystick; /* Joystick */
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
extern void SDL_AtariXbios_Install(_KBDVECS *kbdvecs,void *newmousevector,void *newjoystickvector);
|
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_MouseVector(void *buf);
|
||||||
extern void SDL_AtariXbios_JoystickVector(void *buf);
|
extern void SDL_AtariXbios_JoystickVector(void *buf);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue