src/video/ataricommon/SDL_xbiosevents.c
changeset 3283 1ed5d432e468
parent 3282 10a12f77f597
child 3284 2b95b2c0b6d4
     1.1 --- a/src/video/ataricommon/SDL_xbiosevents.c	Sun Sep 20 04:13:23 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,161 +0,0 @@
     1.4 -/*
     1.5 -    SDL - Simple DirectMedia Layer
     1.6 -    Copyright (C) 1997-2009 Sam Lantinga
     1.7 -
     1.8 -    This library is free software; you can redistribute it and/or
     1.9 -    modify it under the terms of the GNU Lesser General Public
    1.10 -    License as published by the Free Software Foundation; either
    1.11 -    version 2.1 of the License, or (at your option) any later version.
    1.12 -
    1.13 -    This library is distributed in the hope that it will be useful,
    1.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 -    Lesser General Public License for more details.
    1.17 -
    1.18 -    You should have received a copy of the GNU Lesser General Public
    1.19 -    License along with this library; if not, write to the Free Software
    1.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.21 -
    1.22 -    Sam Lantinga
    1.23 -    slouken@libsdl.org
    1.24 -*/
    1.25 -#include "SDL_config.h"
    1.26 -
    1.27 -/*
    1.28 - *	XBIOS mouse & joystick vectors
    1.29 - *
    1.30 - *	Patrice Mandin
    1.31 - */
    1.32 -
    1.33 -#include <mint/osbind.h>
    1.34 -
    1.35 -#include "../../events/SDL_events_c.h"
    1.36 -#include "SDL_xbiosevents_c.h"
    1.37 -#include "SDL_xbiosinterrupt_s.h"
    1.38 -
    1.39 -/* Variables */
    1.40 -
    1.41 -int SDL_AtariXbios_enabled = 0;
    1.42 -
    1.43 -/* Local variables */
    1.44 -
    1.45 -static _KBDVECS *kbdvecs;       /* Pointer to access system vectors */
    1.46 -static Uint16 atari_prevmouseb; /* buttons */
    1.47 -
    1.48 -/* Functions */
    1.49 -
    1.50 -void
    1.51 -SDL_AtariXbios_InstallVectors(int vectors_mask)
    1.52 -{
    1.53 -    void *oldpile;
    1.54 -
    1.55 -    /* Clear variables */
    1.56 -    SDL_AtariXbios_mouselock =
    1.57 -        SDL_AtariXbios_mouseb =
    1.58 -        SDL_AtariXbios_mousex =
    1.59 -        SDL_AtariXbios_mousey =
    1.60 -        SDL_AtariXbios_joystick = atari_prevmouseb = 0;
    1.61 -
    1.62 -    if (vectors_mask == 0) {
    1.63 -        SDL_AtariXbios_enabled = 0;
    1.64 -        return;
    1.65 -    }
    1.66 -
    1.67 -    /* Read IKBD vectors base */
    1.68 -    kbdvecs = Kbdvbase();
    1.69 -
    1.70 -    /* Go to supervisor mode */
    1.71 -    oldpile = (void *) Super(0);
    1.72 -
    1.73 -    /* Install our vectors */
    1.74 -    SDL_AtariXbios_Install(kbdvecs,
    1.75 -                           (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ?
    1.76 -                           SDL_AtariXbios_MouseVector : NULL,
    1.77 -                           (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ?
    1.78 -                           SDL_AtariXbios_JoystickVector : NULL);
    1.79 -
    1.80 -    /* Back to user mode */
    1.81 -    Super(oldpile);
    1.82 -
    1.83 -    SDL_AtariXbios_enabled = 1;
    1.84 -}
    1.85 -
    1.86 -void
    1.87 -SDL_AtariXbios_RestoreVectors(void)
    1.88 -{
    1.89 -    void *oldpile;
    1.90 -
    1.91 -    if (SDL_AtariXbios_enabled == 0) {
    1.92 -        return;
    1.93 -    }
    1.94 -
    1.95 -    /* Read IKBD vectors base */
    1.96 -    kbdvecs = Kbdvbase();
    1.97 -
    1.98 -    /* Go to supervisor mode */
    1.99 -    oldpile = (void *) Super(NULL);
   1.100 -
   1.101 -    /* Reinstall system vector */
   1.102 -    SDL_AtariXbios_Restore(kbdvecs);
   1.103 -
   1.104 -    /* Back to user mode */
   1.105 -    Super(oldpile);
   1.106 -}
   1.107 -
   1.108 -static int
   1.109 -atari_GetButton(int button)
   1.110 -{
   1.111 -    switch (button) {
   1.112 -    case 0:
   1.113 -        return SDL_BUTTON_RIGHT;
   1.114 -        break;
   1.115 -    case 1:
   1.116 -    default:
   1.117 -        return SDL_BUTTON_LEFT;
   1.118 -        break;
   1.119 -    }
   1.120 -}
   1.121 -
   1.122 -void
   1.123 -SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents)
   1.124 -{
   1.125 -    if (SDL_AtariXbios_enabled == 0) {
   1.126 -        return;
   1.127 -    }
   1.128 -
   1.129 -    /* Mouse motion ? */
   1.130 -    if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
   1.131 -        SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex,
   1.132 -                               SDL_AtariXbios_mousey);
   1.133 -        SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
   1.134 -    }
   1.135 -
   1.136 -    /* Mouse button ? */
   1.137 -    if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) {
   1.138 -        int i;
   1.139 -
   1.140 -        for (i = 0; i < 2; i++) {
   1.141 -            int curbutton, prevbutton;
   1.142 -
   1.143 -            curbutton = SDL_AtariXbios_mouseb & (1 << i);
   1.144 -            prevbutton = atari_prevmouseb & (1 << i);
   1.145 -
   1.146 -            if (curbutton && !prevbutton) {
   1.147 -                SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
   1.148 -            }
   1.149 -            if (!curbutton && prevbutton) {
   1.150 -                SDL_PrivateMouseButton(SDL_RELEASED,
   1.151 -                                       atari_GetButton(i), 0, 0);
   1.152 -            }
   1.153 -        }
   1.154 -        atari_prevmouseb = SDL_AtariXbios_mouseb;
   1.155 -    }
   1.156 -}
   1.157 -
   1.158 -void
   1.159 -SDL_AtariXbios_LockMousePosition(SDL_bool lockPosition)
   1.160 -{
   1.161 -    SDL_AtariXbios_mouselock = lockPosition;
   1.162 -}
   1.163 -
   1.164 -/* vi: set ts=4 sw=4 expandtab: */